Struct magic_wormhole::transit::Transit
source · pub struct Transit { /* private fields */ }
Expand description
An established Transit connection.
While you can manually send and receive bytes over the TCP stream, this is not recommended as the transit protocol also specifies an encrypted record pipe that does all the hard work for you. See the provided methods.
Implementations§
source§impl Transit
impl Transit
sourcepub async fn receive_record(&mut self) -> Result<Box<[u8]>, TransitError>
pub async fn receive_record(&mut self) -> Result<Box<[u8]>, TransitError>
Receive and decrypt one message from the other side.
sourcepub async fn send_record(
&mut self,
plaintext: &[u8]
) -> Result<(), TransitError>
pub async fn send_record( &mut self, plaintext: &[u8] ) -> Result<(), TransitError>
Send an encrypted message to the other side
pub async fn flush(&mut self) -> Result<(), TransitError>
sourcepub fn split(
self
) -> (impl Sink<Box<[u8]>, Error = TransitError>, impl Stream<Item = Result<Box<[u8]>, TransitError>>)
pub fn split( self ) -> (impl Sink<Box<[u8]>, Error = TransitError>, impl Stream<Item = Result<Box<[u8]>, TransitError>>)
Convert the transit connection to a [Stream
]/[Sink
] pair
Auto Trait Implementations§
impl !RefUnwindSafe for Transit
impl Send for Transit
impl !Sync for Transit
impl Unpin for Transit
impl !UnwindSafe for Transit
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