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,

source

pub fn new( last_activity: I, timeout: I::Duration, last_transfer_id: Option<T>, data: D ) -> Self

Creates a new session

source

pub fn is_expired(&self, now: I) -> bool

Returns true if this session has expired and should be removed

source

pub fn last_activity(&self) -> &I

Returns the time when this session was last active

source

pub fn set_last_activity(&mut self, time: I)

Sets the time when this session was last active

source

pub fn timeout(&self) -> I::Duration

Returns the timeout duration for this session

source

pub fn last_transfer_id(&self) -> Option<&T>

Returns the ID of the last received transfer, if any

source

pub fn set_last_transfer_id(&mut self, id: T)

Sets the ID of the most recently received transfer

source

pub fn data(&self) -> &D

Returns a reference to the transport-specific data

source

pub fn data_mut(&mut self) -> &mut D

Returns a mutable reference to the transport-specific data

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.