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:
parent
40b0884ae3
commit
29ce96dd21
1 changed files with 12 additions and 0 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue