Skip to main content

State

Struct State 

Source
pub struct State<'d, D, B>
where D: Session<'d>,
{ /* private fields */ }
Expand description

One protocol-neutral session paired with its carrier-owned input buffer.

Implementations§

Source§

impl<'d, D, B> State<'d, D, B>
where D: Session<'d>, B: Buf<'d>,

Source

pub fn open(session: D, buffer: B) -> Self

Source

pub fn finished(session: D, buffer: B) -> Self

Source

pub fn into_buffer(self) -> B

Cancels the session and returns its queued carrier input.

Source

pub const fn status(&self) -> Status

Source

pub fn work(&self) -> Work

Source

pub fn push( &mut self, input: B::Input, boundary: Boundary, ) -> Result<(), PushError<B::Input, B::Error>>

Appends one exact DATA owner to the carrier buffer without exposing the session machine between admission and callback consumption.

Source

pub fn finish(&mut self) -> Result<(), FinishError>

Records one peer FIN. Empty input can enter the machine immediately; queued bytes retain priority over the terminal callback.

Source

pub fn transact<R, E>( &mut self, admit: impl for<'turn> FnOnce(Emission<'turn, 'd, D>) -> Admission<'turn, 'd, D, R, E>, ) -> Turn<Transaction<R, E>, B::Receipt>

Removes at most one carrier quantum and executes exactly one canonical session/admission transaction. The returned receipt proves which carrier quantum was removed during this transaction.

Auto Trait Implementations§

§

impl<'d, D, B> !RefUnwindSafe for State<'d, D, B>

§

impl<'d, D, B> !Send for State<'d, D, B>

§

impl<'d, D, B> !Sync for State<'d, D, B>

§

impl<'d, D, B> !UnwindSafe for State<'d, D, B>

§

impl<'d, D, B> Forget for State<'d, D, B>

§

impl<'d, D, B> Freeze for State<'d, D, B>
where Machine<'d, D>: Freeze, B: Freeze,

§

impl<'d, D, B> Unpin for State<'d, D, B>
where Machine<'d, D>: Unpin, B: Unpin,

§

impl<'d, D, B> UnsafeUnpin for State<'d, D, B>
where Machine<'d, D>: UnsafeUnpin, B: UnsafeUnpin,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> Convert<T> for T

Source§

fn into(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.