pub struct ChannelAdapter { /* private fields */ }Expand description
Bridges simulation and live environments through typed channels.
Implementations§
Source§impl ChannelAdapter
impl ChannelAdapter
pub fn new(mode: ChannelMode) -> Self
pub fn live() -> Self
pub fn simulated() -> Self
pub fn bridging() -> Self
Sourcepub fn with_max_buffer(self, max: usize) -> Self
pub fn with_max_buffer(self, max: usize) -> Self
Set maximum buffer per channel
Sourcepub fn send_typed(
&mut self,
kind: ChannelKind,
source: &str,
payload: &[u8],
) -> bool
pub fn send_typed( &mut self, kind: ChannelKind, source: &str, payload: &[u8], ) -> bool
Send a typed message to a channel
Sourcepub fn send_sim(
&mut self,
kind: ChannelKind,
source: &str,
payload: &[u8],
) -> bool
pub fn send_sim( &mut self, kind: ChannelKind, source: &str, payload: &[u8], ) -> bool
Send a simulation-originated message
Sourcepub fn recv(&mut self, kind: ChannelKind) -> Option<Vec<u8>>
pub fn recv(&mut self, kind: ChannelKind) -> Option<Vec<u8>>
Receive from a channel (returns payload only)
Sourcepub fn recv_full(&mut self, kind: ChannelKind) -> Option<ChannelMessage>
pub fn recv_full(&mut self, kind: ChannelKind) -> Option<ChannelMessage>
Receive full message with metadata
Sourcepub fn bridge(&mut self, from: ChannelKind, to: ChannelKind) -> usize
pub fn bridge(&mut self, from: ChannelKind, to: ChannelKind) -> usize
Bridge: take all sim messages from one channel, tag them, push to another
Sourcepub fn channel_size(&self, kind: ChannelKind) -> usize
pub fn channel_size(&self, kind: ChannelKind) -> usize
Buffer size for a channel
Sourcepub fn total_buffered(&self) -> usize
pub fn total_buffered(&self) -> usize
Total buffered across all channels
Sourcepub fn set_mode(&mut self, mode: ChannelMode)
pub fn set_mode(&mut self, mode: ChannelMode)
Switch mode
Sourcepub fn stats(&self) -> ChannelStats
pub fn stats(&self) -> ChannelStats
Stats
Trait Implementations§
Source§impl ChannelLayer for ChannelAdapter
impl ChannelLayer for ChannelAdapter
Source§impl Clone for ChannelAdapter
impl Clone for ChannelAdapter
Source§fn clone(&self) -> ChannelAdapter
fn clone(&self) -> ChannelAdapter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChannelAdapter
impl RefUnwindSafe for ChannelAdapter
impl Send for ChannelAdapter
impl Sync for ChannelAdapter
impl Unpin for ChannelAdapter
impl UnsafeUnpin for ChannelAdapter
impl UnwindSafe for ChannelAdapter
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