pub struct Session<I, T, D> where
I: Instant, { /* private fields */ }
Expand description
A session, associated with a port ID and source node ID
Multiple transfers may be received during the lifetime of a session
Implementations
sourceimpl<I, T, D> Session<I, T, D> where
I: Instant,
impl<I, T, D> Session<I, T, D> where
I: Instant,
sourcepub fn new(
last_activity: I,
timeout: <I as Instant>::Duration,
last_transfer_id: Option<T>,
data: D
) -> Session<I, T, D>
pub fn new(
last_activity: I,
timeout: <I as Instant>::Duration,
last_transfer_id: Option<T>,
data: D
) -> Session<I, T, D>
Creates a new session
sourcepub fn is_expired(&self, now: I) -> bool
pub fn is_expired(&self, now: I) -> bool
Returns true if this session has expired and should be removed
sourcepub fn last_activity(&self) -> &I
pub fn last_activity(&self) -> &I
Returns the time when this session was last active
sourcepub fn set_last_activity(&mut self, time: I)
pub fn set_last_activity(&mut self, time: I)
Sets the time when this session was last active
sourcepub fn timeout(&self) -> <I as Instant>::Duration
pub fn timeout(&self) -> <I as Instant>::Duration
Returns the timeout duration for this session
sourcepub fn last_transfer_id(&self) -> Option<&T>
pub fn last_transfer_id(&self) -> Option<&T>
Returns the ID of the last received transfer, if any
sourcepub fn set_last_transfer_id(&mut self, id: T)
pub fn set_last_transfer_id(&mut self, id: T)
Sets the ID of the most recently received transfer
Auto Trait Implementations
impl<I, T, D> RefUnwindSafe for Session<I, T, D> where
D: RefUnwindSafe,
I: RefUnwindSafe,
T: RefUnwindSafe,
<I as Instant>::Duration: RefUnwindSafe,
impl<I, T, D> Send for Session<I, T, D> where
D: Send,
I: Send,
T: Send,
<I as Instant>::Duration: Send,
impl<I, T, D> Sync for Session<I, T, D> where
D: Sync,
I: Sync,
T: Sync,
<I as Instant>::Duration: Sync,
impl<I, T, D> Unpin for Session<I, T, D> where
D: Unpin,
I: Unpin,
T: Unpin,
<I as Instant>::Duration: Unpin,
impl<I, T, D> UnwindSafe for Session<I, T, D> where
D: UnwindSafe,
I: UnwindSafe,
T: UnwindSafe,
<I as Instant>::Duration: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more