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:
parent
ff02e3c06b
commit
b4a7b4d810
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue