1
 2
 3
 4
 5
 6
 7
 8
 9
10
//! Generic authorization routines.

/// Marker trait of role.
/// Implement it for your struct or enum to represent roles in your services.
pub trait Role { }

/// Implementor should be authorized.
pub trait Authorize<T: Role> {
    fn set_role(&mut self, role: Option<T>) -> Option<T>;
}