Struct expectrl::interact::Context

source ·
pub struct Context<'a, Session, Input, Output, State> {
    pub session: &'a mut Session,
    pub input: &'a mut Input,
    pub output: &'a mut Output,
    pub state: &'a mut State,
    pub buf: &'a [u8],
    pub eof: bool,
}
Expand description

Context provides an interface to use a Session, IO streams and a state.

It’s used primarily in callbacks for InteractSession.

Fields§

§session: &'a mut Session

The field contains a &mut reference to a Session.

§input: &'a mut Input

The field contains an input structure which was used in InteractSession.

§output: &'a mut Output

The field contains an output structure which was used in InteractSession.

§state: &'a mut State

The field contains a user defined data.

§buf: &'a [u8]

The field contains a bytes which were consumed from a user or the running process.

§eof: bool

A flag for EOF of a user session or running process.

Implementations§

source§

impl<'a, Session, Input, Output, State> Context<'a, Session, Input, Output, State>

source

pub fn new( session: &'a mut Session, input: &'a mut Input, output: &'a mut Output, state: &'a mut State, buf: &'a [u8], eof: bool ) -> Self

Creates a new Context structure.

Trait Implementations§

source§

impl<'a, Session: Debug, Input: Debug, Output: Debug, State: Debug> Debug for Context<'a, Session, Input, Output, State>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, Session, Input, Output, State> RefUnwindSafe for Context<'a, Session, Input, Output, State>where Input: RefUnwindSafe, Output: RefUnwindSafe, Session: RefUnwindSafe, State: RefUnwindSafe,

§

impl<'a, Session, Input, Output, State> Send for Context<'a, Session, Input, Output, State>where Input: Send, Output: Send, Session: Send, State: Send,

§

impl<'a, Session, Input, Output, State> Sync for Context<'a, Session, Input, Output, State>where Input: Sync, Output: Sync, Session: Sync, State: Sync,

§

impl<'a, Session, Input, Output, State> Unpin for Context<'a, Session, Input, Output, State>

§

impl<'a, Session, Input, Output, State> !UnwindSafe for Context<'a, Session, Input, Output, State>

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
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.
source§

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

Performs the conversion.