1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-02-22 20:52:27 +00:00

add convenient methods for AuthResult

This commit is contained in:
Dominic 2020-02-08 13:44:46 +01:00
parent ff02e3c06b
commit b4a7b4d810
Signed by: msrd0
GPG key ID: DCC8C247452E98F9

View file

@ -251,6 +251,25 @@ pub enum AuthResult<T>
AuthErr
}
impl<T> AuthResult<T>
{
pub fn is_ok(&self) -> bool
{
match self {
Self::Ok(_) => true,
_ => false
}
}
pub fn unwrap(self) -> T
{
match self {
Self::Ok(data) => data,
_ => panic!()
}
}
}
impl<T> From<T> for AuthResult<T>
{
fn from(t : T) -> Self