pub struct PointToPointMesh { /* private fields */ }
Expand description
A mesh that consists of exactly two nodes, communicating over an arbitrary bidirectional byte stream.
This byte stream could be a stream socket, a Windows named pipe, or a serial port, for example.
There is no support for OS resources (handles or file descriptors) in this mesh implementation. Any attempt to send OS resources will fail the underlying channel.
Implementations§
Source§impl PointToPointMesh
impl PointToPointMesh
Sourcepub fn new(
spawn: impl Spawn,
conn: impl 'static + AsyncRead + AsyncWrite + Send + Unpin,
port: Port,
) -> Self
pub fn new( spawn: impl Spawn, conn: impl 'static + AsyncRead + AsyncWrite + Send + Unpin, port: Port, ) -> Self
Makes a new mesh over the connection conn
, with initial port port
.
let (left, right) = UnixStream::pair().unwrap();
let (a, ax) = channel::<u32>();
let (bx, mut b) = channel::<u32>();
let left = PointToPointMesh::new(&driver, PolledSocket::new(&driver, left).unwrap(), ax.into());
let right = PointToPointMesh::new(&driver, PolledSocket::new(&driver, right).unwrap(), bx.into());
a.send(5);
assert_eq!(b.recv().await.unwrap(), 5);
Auto Trait Implementations§
impl Freeze for PointToPointMesh
impl !RefUnwindSafe for PointToPointMesh
impl Send for PointToPointMesh
impl Sync for PointToPointMesh
impl Unpin for PointToPointMesh
impl !UnwindSafe for PointToPointMesh
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