pub struct RoleElevation { /* private fields */ }Expand description
A temporary role elevation for a subject.
Implementations§
Source§impl RoleElevation
impl RoleElevation
Sourcepub fn with_reason(
role_name: String,
duration: Option<Duration>,
reason: String,
) -> Self
pub fn with_reason( role_name: String, duration: Option<Duration>, reason: String, ) -> Self
Create a role elevation with a reason.
Sourcepub fn created_at(&self) -> Instant
pub fn created_at(&self) -> Instant
Get when the elevation was created.
Sourcepub fn is_expired(&self, now: Instant) -> bool
pub fn is_expired(&self, now: Instant) -> bool
Check if the elevation has expired.
Sourcepub fn time_remaining(&self, now: Instant) -> Option<Duration>
pub fn time_remaining(&self, now: Instant) -> Option<Duration>
Get the time remaining for this elevation.
Trait Implementations§
Source§impl Clone for RoleElevation
impl Clone for RoleElevation
Source§fn clone(&self) -> RoleElevation
fn clone(&self) -> RoleElevation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RoleElevation
impl RefUnwindSafe for RoleElevation
impl Send for RoleElevation
impl Sync for RoleElevation
impl Unpin for RoleElevation
impl UnwindSafe for RoleElevation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more