Struct tcp::TcpState

source ·
pub struct TcpState<X: Dependencies>(/* private fields */);

Implementations§

source§

impl<X: Dependencies> TcpState<X>

source

pub fn new(deps: X, config: TcpConfig) -> Self

source

pub fn close(&mut self) -> Result<(), CloseError>

source

pub fn shutdown(&mut self, how: Shutdown) -> Result<(), ShutdownError>

source

pub fn listen<T, E>( &mut self, backlog: u32, associate_fn: impl FnOnce() -> Result<T, E>, ) -> Result<T, ListenError<E>>

source

pub fn connect<T, E>( &mut self, addr: SocketAddrV4, associate_fn: impl FnOnce() -> Result<(SocketAddrV4, T), E>, ) -> Result<T, ConnectError<E>>

source

pub fn accept(&mut self) -> Result<AcceptedTcpState<X>, AcceptError>

source

pub fn send( &mut self, reader: impl Read, len: usize, ) -> Result<usize, SendError>

source

pub fn recv( &mut self, writer: impl Write, len: usize, ) -> Result<usize, RecvError>

source

pub fn push_packet( &mut self, header: &TcpHeader, payload: Payload, ) -> Result<u32, PushPacketError>

source

pub fn pop_packet(&mut self) -> Result<(TcpHeader, Payload), PopPacketError>

source

pub fn clear_error(&mut self) -> Option<TcpError>

source

pub fn poll(&self) -> PollState

source

pub fn wants_to_send(&self) -> bool

source

pub fn local_remote_addrs(&self) -> Option<(SocketAddrV4, SocketAddrV4)>

Trait Implementations§

source§

impl<X: Debug + Dependencies> Debug for TcpState<X>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<X> Freeze for TcpState<X>
where X: Freeze, <X as Dependencies>::Instant: Freeze,

§

impl<X> RefUnwindSafe for TcpState<X>

§

impl<X> Send for TcpState<X>
where X: Send, <X as Dependencies>::Instant: Send,

§

impl<X> Sync for TcpState<X>
where X: Sync, <X as Dependencies>::Instant: Sync,

§

impl<X> Unpin for TcpState<X>
where X: Unpin, <X as Dependencies>::Instant: Unpin,

§

impl<X> UnwindSafe for TcpState<X>

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> 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 = 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 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.