1
0
Fork 0
mirror of https://github.com/kotovalexarian/jsonapis.rs.git synced 2024-10-30 11:53:58 -04:00

Add more unwrap/expect functions for builders

This commit is contained in:
Alex Kotov 2021-09-28 17:59:23 +05:00
parent 40b0884ae3
commit 29ce96dd21
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -30,7 +30,19 @@ pub trait Builder: Clone + Debug + Eq + PartialEq + Sized {
fn finish(self) -> Result<Self::Entity, ()>;
fn expect(self, msg: &str) -> Self::Entity {
self.finish().expect(msg)
}
fn expect_err(self, msg: &str) {
self.finish().expect_err(msg)
}
fn unwrap(self) -> Self::Entity {
self.finish().unwrap()
}
fn unwrap_err(self) {
self.finish().unwrap_err()
}
}