Struct canadensis_core::session::Session
source · 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§
source§impl<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::Duration,
last_transfer_id: Option<T>,
data: D
) -> Self
pub fn new( last_activity: I, timeout: I::Duration, last_transfer_id: Option<T>, data: D ) -> Self
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 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