pub struct VecTransport {
pub outgoing: VecDeque<u8>,
pub incoming: VecDeque<u8>,
}Expand description
In-memory loopback transport used in tests and the chaos bus.
Fields§
§outgoing: VecDeque<u8>Bytes the caller has written and that are waiting to be drained by
the peer (or by Self::take_outgoing).
incoming: VecDeque<u8>Bytes the peer has fed in and that the caller is yet to read.
Implementations§
Source§impl VecTransport
impl VecTransport
Sourcepub fn take_outgoing(&mut self) -> Vec<u8> ⓘ
pub fn take_outgoing(&mut self) -> Vec<u8> ⓘ
Drain the write-side queue.
Sourcepub fn shuffle_to(&mut self, other: &mut VecTransport)
pub fn shuffle_to(&mut self, other: &mut VecTransport)
Move every byte from this transport’s outgoing queue into other’s
incoming queue, modelling a one-way half-duplex bus segment. Useful in
loopback tests and examples that wire two VecTransports back-to-back.
Trait Implementations§
Source§impl Debug for VecTransport
impl Debug for VecTransport
Source§impl Default for VecTransport
impl Default for VecTransport
Source§fn default() -> VecTransport
fn default() -> VecTransport
Returns the “default value” for a type. Read more
Source§impl Transport for VecTransport
Available on crate feature alloc only.
impl Transport for VecTransport
Available on crate feature
alloc only.Auto Trait Implementations§
impl Freeze for VecTransport
impl RefUnwindSafe for VecTransport
impl Send for VecTransport
impl Sync for VecTransport
impl Unpin for VecTransport
impl UnsafeUnpin for VecTransport
impl UnwindSafe for VecTransport
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