mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-23 04:52:28 +00:00
add convenient methods for AuthResult
This commit is contained in:
parent
ff02e3c06b
commit
b4a7b4d810
1 changed files with 19 additions and 0 deletions
|
@ -251,6 +251,25 @@ pub enum AuthResult<T>
|
||||||
AuthErr
|
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>
|
impl<T> From<T> for AuthResult<T>
|
||||||
{
|
{
|
||||||
fn from(t : T) -> Self
|
fn from(t : T) -> Self
|
||||||
|
|
Loading…
Add table
Reference in a new issue