pub struct Transceiver<U: UniqueIdentifier, F = Unset, S = Off> {
pub rx: Option<Receiver<Data<U>>>,
/* private fields */
}
Expand description
Transmitter and receiver of gmt_dos-actors Data
Fields§
§rx: Option<Receiver<Data<U>>>
Implementations§
Source§impl<U: UniqueIdentifier> Transceiver<U>
impl<U: UniqueIdentifier> Transceiver<U>
Sourcepub fn receiver<S: Into<String>, C: Into<String>>(
server_address: S,
client_address: C,
) -> Result<Transceiver<U, Receiver>>
pub fn receiver<S: Into<String>, C: Into<String>>( server_address: S, client_address: C, ) -> Result<Transceiver<U, Receiver>>
Transceiver receiver functionality
A receiver is build from both the transmitter and the receiver internet socket addresses
§Examples
use gmt_dos_clients_transceiver::Transceiver;
use interface::UID;
#[derive(UID)]
#[uid(port = 5001)]
pub enum IO {}
let tx_address = "127.0.0.1";
let rx_address = "127.0.0.1:0";
let rx = Transceiver::<IO>::receiver(tx_address,rx_address);
pub fn receiver_builder<S: Into<String>, C: Into<String>>( server_address: S, client_address: C, ) -> ReceiverBuilder<U>
Source§impl<U: UniqueIdentifier> Transceiver<U, Receiver>
impl<U: UniqueIdentifier> Transceiver<U, Receiver>
Sourcepub fn spawn<V: UniqueIdentifier, A: Into<String>>(
&self,
server_address: A,
) -> Result<Transceiver<V, Receiver>>
pub fn spawn<V: UniqueIdentifier, A: Into<String>>( &self, server_address: A, ) -> Result<Transceiver<V, Receiver>>
Spawn a new Transceiver receiver
clone the receiver endpoint that will
server_address
to connect to
Source§impl<U: UniqueIdentifier + 'static> Transceiver<U, Receiver>
impl<U: UniqueIdentifier + 'static> Transceiver<U, Receiver>
Source§impl<U: UniqueIdentifier> Transceiver<U>
impl<U: UniqueIdentifier> Transceiver<U>
Sourcepub fn transmitter<S: Into<String>>(
address: S,
) -> Result<Transceiver<U, Transmitter>>
pub fn transmitter<S: Into<String>>( address: S, ) -> Result<Transceiver<U, Transmitter>>
Transceiver transmitter functionality
A transmitter is build from its internet socket address
§Examples
use gmt_dos_clients_transceiver::Transceiver;
use interface::UID;
#[derive(UID)]
#[uid(port = 5001)]
pub enum IO {}
let address = "127.0.0.1";
let tx = Transceiver::<IO>::transmitter(address);
pub fn transmitter_builder<S: Into<String>>(address: S) -> TransmitterBuilder<U>
Source§impl<U: UniqueIdentifier + 'static> Transceiver<U, Transmitter>
impl<U: UniqueIdentifier + 'static> Transceiver<U, Transmitter>
Sourcepub fn run(self, monitor: &mut Monitor) -> Transceiver<U, Transmitter, On>
pub fn run(self, monitor: &mut Monitor) -> Transceiver<U, Transmitter, On>
Send data to the receiver
Communication with the receiver happens in a separate thread. The transmitter will hold until the receiver calls in.
Source§impl<U: UniqueIdentifier, F> Transceiver<U, F>
impl<U: UniqueIdentifier, F> Transceiver<U, F>
Source§impl<U: UniqueIdentifier, F, S> Transceiver<U, F, S>
impl<U: UniqueIdentifier, F, S> Transceiver<U, F, S>
pub fn take_channel_receiver(&mut self) -> Option<Receiver<Data<U>>>
pub fn take_channel_transmitter(&mut self) -> Option<Sender<Data<U>>>
Trait Implementations§
Source§impl<U: UniqueIdentifier, F, S> Debug for Transceiver<U, F, S>
impl<U: UniqueIdentifier, F, S> Debug for Transceiver<U, F, S>
Source§impl<U: UniqueIdentifier, F, S> Display for Transceiver<U, F, S>
impl<U: UniqueIdentifier, F, S> Display for Transceiver<U, F, S>
Source§impl<U: UniqueIdentifier> From<&Transceiver<U, Receiver>> for CompactRecvr
impl<U: UniqueIdentifier> From<&Transceiver<U, Receiver>> for CompactRecvr
Source§fn from(value: &Transceiver<U, Receiver>) -> Self
fn from(value: &Transceiver<U, Receiver>) -> Self
Converts to this type from the input type.
Source§impl<U: UniqueIdentifier> Read<U> for Transceiver<U, Transmitter, On>
impl<U: UniqueIdentifier> Read<U> for Transceiver<U, Transmitter, On>
Source§impl<U: UniqueIdentifier, F: RxOrTx + Send + Sync> Update for Transceiver<U, F, On>
impl<U: UniqueIdentifier, F: RxOrTx + Send + Sync> Update for Transceiver<U, F, On>
Auto Trait Implementations§
impl<U, F, S> Freeze for Transceiver<U, F, S>
impl<U, F = Unset, S = Off> !RefUnwindSafe for Transceiver<U, F, S>
impl<U, F, S> Send for Transceiver<U, F, S>
impl<U, F, S> Sync for Transceiver<U, F, S>
impl<U, F, S> Unpin for Transceiver<U, F, S>
impl<U, F = Unset, S = Off> !UnwindSafe for Transceiver<U, F, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more