Connection

Struct Connection 

Source
pub struct Connection<S: Stream> { /* private fields */ }
Expand description

Connection with a stream that can be cloned if split into receiver and sender. Connection combines such stream for a specific destination address.

This connection type is used by FTCP and Brontide protocols.

Implementations§

Source§

impl<S: Stream> Connection<S>

Source

pub fn with(stream: TcpStream, remote_addr: InetSocketAddr) -> Self

Source§

impl<const LEN_SIZE: usize> Connection<Stream<LEN_SIZE>>

Source

pub fn connect(inet_addr: InetSocketAddr) -> Result<Self, Error>

Source

pub fn accept(listener: &TcpListener) -> Result<Self, Error>

Source§

impl Connection<Stream>

Source

pub fn connect(inet_addr: InetSocketAddr) -> Result<Self, Error>

Source

pub fn accept(listener: &TcpListener) -> Result<Self, Error>

Trait Implementations§

Source§

impl<S: Stream + Bipolar<Left = S, Right = S>> Bipolar for Connection<S>

Source§

type Left = S

First separable type (like reader)
Source§

type Right = S

Second separable type (like writer)
Source§

fn join(left: S, right: S) -> Self

Reconstruct the type from the halves
Source§

fn split(self) -> (Self::Left, Self::Right)

Split the type into two
Source§

impl<S: Debug + Stream> Debug for Connection<S>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<S: Stream + DuplexConnection> DuplexConnection for Connection<S>

Source§

fn as_receiver(&mut self) -> &mut dyn RecvFrame

Source§

fn as_sender(&mut self) -> &mut dyn SendFrame

Source§

fn split(self) -> (Box<dyn RecvFrame + Send>, Box<dyn SendFrame + Send>)

Auto Trait Implementations§

§

impl<S> Freeze for Connection<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for Connection<S>
where S: RefUnwindSafe,

§

impl<S> Send for Connection<S>
where S: Send,

§

impl<S> Sync for Connection<S>
where S: Sync,

§

impl<S> Unpin for Connection<S>
where S: Unpin,

§

impl<S> UnwindSafe for Connection<S>
where S: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V