Skip to main content

Transceiver

Struct Transceiver 

Source
pub struct Transceiver<TyTx, TyRx, TrTx, TrRx, C: CodecFor<TyTx> + CodecFor<TyRx>> { /* private fields */ }
Expand description

A typed, multidirectional endpoint pairing a send half and a receive half.

The two halves carry independent transport types: the full-duplex consortium_ipc_transport_memory::SharedMemoryTransport is split into a …Tx send half and a …Rx receive half, and each is the transport of its respective Channel.

§Type parameters

  • TyTx / TyRx - the sent and received message types
  • TrTx - send-half transport (SendTransport)
  • TrRx - receive-half transport (RecvTransport)
  • C - codec

Implementations§

Source§

impl<TyTx, TyRx, TrTx, TrRx, C: CodecFor<TyTx> + CodecFor<TyRx>> Transceiver<TyTx, TyRx, TrTx, TrRx, C>

Source

pub fn new( tx: Channel<Tx, TyTx, TrTx, C>, rx: Channel<Rx, TyRx, TrRx, C>, ) -> Self

Create a new Transceiver from a send half and a receive half.

Source

pub fn tx(&self) -> &Channel<Tx, TyTx, TrTx, C>

Get the send half of the transceiver.

Source

pub fn rx(&self) -> &Channel<Rx, TyRx, TrRx, C>

Get the receive half of the transceiver.

Source

pub fn split(self) -> (Channel<Tx, TyTx, TrTx, C>, Channel<Rx, TyRx, TrRx, C>)

split into two channels

Source§

impl<TyTx, TyRx, TrTx, TrRx, C> Transceiver<TyTx, TyRx, TrTx, TrRx, C>
where TrTx: SendTransport, C: CodecFor<TyTx> + CodecFor<TyRx>,

Source

pub async fn send(&mut self, msg: &TyTx) -> Result<(), ChannelError<C, TrTx>>

send message

Source§

impl<TyTx, TyRx, TrTx, TrRx, C> Transceiver<TyTx, TyRx, TrTx, TrRx, C>
where TrRx: RecvTransport, C: CodecFor<TyTx> + CodecFor<TyRx>,

Source

pub async fn recv( &mut self, ) -> Result<ReceivedMessage<'_, TyRx, C>, ChannelError<C, TrRx>>

receive message

Auto Trait Implementations§

§

impl<TyTx, TyRx, TrTx, TrRx, C> !UnwindSafe for Transceiver<TyTx, TyRx, TrTx, TrRx, C>

§

impl<TyTx, TyRx, TrTx, TrRx, C> Freeze for Transceiver<TyTx, TyRx, TrTx, TrRx, C>
where TrTx: Freeze, TrRx: Freeze,

§

impl<TyTx, TyRx, TrTx, TrRx, C> RefUnwindSafe for Transceiver<TyTx, TyRx, TrTx, TrRx, C>

§

impl<TyTx, TyRx, TrTx, TrRx, C> Send for Transceiver<TyTx, TyRx, TrTx, TrRx, C>
where TrTx: Send, TrRx: Send, TyTx: Send, C: Send, TyRx: Send,

§

impl<TyTx, TyRx, TrTx, TrRx, C> Sync for Transceiver<TyTx, TyRx, TrTx, TrRx, C>
where TrTx: Sync, TrRx: Sync, TyTx: Sync, C: Sync, TyRx: Sync,

§

impl<TyTx, TyRx, TrTx, TrRx, C> Unpin for Transceiver<TyTx, TyRx, TrTx, TrRx, C>
where TrTx: Unpin, TrRx: Unpin, TyTx: Unpin, C: Unpin, TyRx: Unpin,

§

impl<TyTx, TyRx, TrTx, TrRx, C> UnsafeUnpin for Transceiver<TyTx, TyRx, TrTx, TrRx, C>
where TrTx: UnsafeUnpin, TrRx: UnsafeUnpin,

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

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.