Struct ntex::framed::State[][src]

pub struct State(_);

Implementations

impl State[src]

pub fn new() -> Self[src]

Create State instance

pub fn from_framed<Io, U>(framed: Framed<Io, U>) -> (Io, U, Self)[src]

Create State from Framed

pub fn with_params(
    max_read_buf_size: u16,
    max_write_buf_size: u16,
    min_buf_size: u16,
    disconnect_timeout: u16
) -> Self
[src]

Create State instance with custom params

pub fn into_framed<Io, U>(self, io: Io, codec: U) -> Framed<Io, U>[src]

Convert State to a Framed instance

pub fn set_buffer_params(
    &self,
    max_read_buf_size: u16,
    max_write_buf_size: u16,
    min_buf_size: u16
)
[src]

Set read/write buffer sizes

By default read max buf size is 8kb, write max buf size is 8kb

pub fn set_disconnect_timeout(&self, timeout: u16)[src]

Set io disconnect timeout in secs

pub fn on_disconnect(&self) -> OnDisconnect

Notable traits for OnDisconnect

impl Future for OnDisconnect type Output = ();
[src]

Notify when socket get disconnected

pub fn is_io_err(&self) -> bool[src]

Check if io error occured in read or write task

pub fn is_keepalive(&self) -> bool[src]

Check if keep-alive timeout occured

pub fn is_dispatcher_stopped(&self) -> bool[src]

Check is dispatcher marked stopped

pub fn is_open(&self) -> bool[src]

pub fn stop_io(&self, waker: &Waker)[src]

Stop io tasks

Wake dispatcher when read or write task is stopped.

pub fn shutdown_io(&self)[src]

Gracefully shutdown read and write io tasks

pub fn take_io_error(&self) -> Option<Error>[src]

Take io error if any occured

pub fn reset_io_stop(&self)[src]

Reset io stop flags

pub fn reset_keepalive(&self)[src]

Reset keep-alive error

pub fn wake_dispatcher(&self)[src]

Wake dispatcher task

pub fn register_dispatcher(&self, waker: &Waker)[src]

Register dispatcher task

pub fn dispatcher_stopped(&self)[src]

Mark dispatcher as stopped

pub fn read(&self) -> Read<'_>[src]

Get api for read task

pub fn write(&self) -> Write<'_>[src]

Get api for write task

pub fn close(&self)[src]

Gracefully close connection

First stop dispatcher, then dispatcher stops io tasks

pub fn force_close(&self)[src]

Force close connection

Dispatcher does not wait for uncompleted responses, but flushes io buffers.

impl State[src]

pub async fn next<T, U>(
    &self,
    io: &mut T,
    codec: &U
) -> Result<Option<U::Item>, Either<U::Error, Error>> where
    T: AsyncRead + AsyncWrite + Unpin,
    U: Decoder
[src]

Read incoming io stream and decode codec item.

pub async fn send<T, U>(
    &self,
    io: &mut T,
    codec: &U,
    item: U::Item
) -> Result<(), Either<U::Error, Error>> where
    T: AsyncRead + AsyncWrite + Unpin,
    U: Encoder
[src]

Encode item, send to a peer and then flush

pub fn poll_next<T, U>(
    &self,
    io: &mut T,
    codec: &U,
    cx: &mut Context<'_>
) -> Poll<Result<Option<U::Item>, Either<U::Error, Error>>> where
    T: AsyncRead + AsyncWrite + Unpin,
    U: Decoder
[src]

Trait Implementations

impl Clone for State[src]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Hash for State[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<State> for State[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Eq for State[src]

Auto Trait Implementations

impl !RefUnwindSafe for State

impl !Send for State

impl !Sync for State

impl Unpin for State

impl !UnwindSafe for State

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> CallHasher for T where
    T: Hash + ?Sized
[src]

pub default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where
    H: Hash + ?Sized,
    B: BuildHasher
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.