Skip to main content

ChannelTransport

Struct ChannelTransport 

Source
pub struct ChannelTransport<C> { /* private fields */ }
Expand description

A [Channel] as a MessageTransport, so a handshake can be driven over anything that carries messages.

A message over MAX_MESSAGE is refused either way (InvalidInput going out, InvalidData coming in), and so is a [Failure::Protocol]; the message drivers report both as DriveError::Io. The read and write timeouts the _until drivers set bound receive and send_timeout; a channel that ended in order is UnexpectedEof. Nothing here authenticates the peer: the handshake does.

Implementations§

Source§

impl<C: Channel> ChannelTransport<C>

Source

pub const fn new(channel: C) -> Self

A transport over channel, with no timeouts.

Source

pub const fn channel(&self) -> &C

The channel, for closing it or asking its capabilities.

Source

pub fn into_inner(self) -> C

The channel.

Trait Implementations§

Source§

impl<C> Debug for ChannelTransport<C>

Source§

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

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

impl<C: Channel> MessageTransport for ChannelTransport<C>

Source§

fn send(&mut self, message: &[u8]) -> Result<()>

Sends one message. Read more
Source§

fn recv(&mut self) -> Result<Vec<u8>>

Receives the next message. Read more
Source§

impl<C> ReadTimeout for ChannelTransport<C>

Source§

fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()>

Sets the timeout of every read from now on; None waits forever. Read more
Source§

impl<C> WriteTimeout for ChannelTransport<C>

Source§

fn set_write_timeout(&self, timeout: Option<Duration>) -> Result<()>

Sets the timeout of every write from now on; None waits forever. Read more

Auto Trait Implementations§

§

impl<C> !Freeze for ChannelTransport<C>

§

impl<C> RefUnwindSafe for ChannelTransport<C>
where C: RefUnwindSafe,

§

impl<C> Send for ChannelTransport<C>
where C: Send,

§

impl<C> Sync for ChannelTransport<C>
where C: Sync,

§

impl<C> Unpin for ChannelTransport<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for ChannelTransport<C>
where C: UnsafeUnpin,

§

impl<C> UnwindSafe for ChannelTransport<C>
where C: 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.