Struct Connection

Source
pub struct Connection {
    pub local_addr: Address,
    pub peer_addr: Address,
    /* private fields */
}
Expand description

§Connection

I/O Object for managing Tcp connections. A new connection can be created by connecting to an endpoint using Connection::new() constructor.

Fields§

§local_addr: Address§peer_addr: Address

Implementations§

Source§

impl Connection

Source

pub async fn new(to: Address) -> Result<Self, Error>

§Constructor

Constructs a new Connection to the provided endpoint.

Trait Implementations§

Source§

impl ReadPreReqs for Connection

Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 mut self, byts: &'life1 mut BytesMut, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl Reader for Connection

Source§

fn read_u8<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<u8>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_u16<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<u16>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_u32<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<u32>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_u64<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_u128<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<u128>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_i8<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<i8>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_i16<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<i16>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_i32<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<i32>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_i64<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_i128<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<i128>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_f32<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<f32>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_f64<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<f64>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn read_string<'life0, 'async_trait>( &'life0 mut self, len: usize, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

impl TryFrom<TcpStream> for Connection

Source§

type Error = Error

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

fn try_from(stream: TcpStream) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl WritePreReqs for Connection

Source§

fn write<'life0, 'life1, 'async_trait>( &'life0 mut self, byts: &'life1 mut BytesMut, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl Writer for Connection

Source§

fn write_u8<'life0, 'async_trait>( &'life0 mut self, data: u8, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_u16<'life0, 'async_trait>( &'life0 mut self, data: u16, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_u32<'life0, 'async_trait>( &'life0 mut self, data: u32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_u64<'life0, 'async_trait>( &'life0 mut self, data: u64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_u128<'life0, 'async_trait>( &'life0 mut self, data: u128, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_i8<'life0, 'async_trait>( &'life0 mut self, data: i8, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_i16<'life0, 'async_trait>( &'life0 mut self, data: i16, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_i32<'life0, 'async_trait>( &'life0 mut self, data: i32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_i64<'life0, 'async_trait>( &'life0 mut self, data: i64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_i128<'life0, 'async_trait>( &'life0 mut self, data: i128, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_f32<'life0, 'async_trait>( &'life0 mut self, data: f32, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_f64<'life0, 'async_trait>( &'life0 mut self, data: f64, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn write_string<'life0, 'async_trait>( &'life0 mut self, data: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Auto Trait Implementations§

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.