pub struct StreamFace<R, W, C: Clone> { /* private fields */ }Expand description
Generic stream-based NDN face.
Wraps any async read/write pair with a codec into a full Face
implementation. The stream is split into independent read and write halves,
each behind its own Mutex:
reader: locked only by the face’s receive task (single consumer, never actually contends).writer: locked by whichever pipeline task callssend(), serialising concurrent sends on the same stream.
The lp_encode flag controls whether send() wraps outgoing packets in
NDNLPv2 LpPacket framing before writing. Network-facing transports (TCP,
Serial) set this to true; local transports (Unix) set it to false.
Implementations§
Trait Implementations§
Source§impl<R, W, C> Face for StreamFace<R, W, C>
impl<R, W, C> Face for StreamFace<R, W, C>
fn id(&self) -> FaceId
fn kind(&self) -> FaceKind
Source§fn remote_uri(&self) -> Option<String>
fn remote_uri(&self) -> Option<String>
Remote URI (e.g.
udp4://192.168.1.1:6363). Returns None for face
types that don’t have a meaningful remote endpoint.Source§fn local_uri(&self) -> Option<String>
fn local_uri(&self) -> Option<String>
Local URI (e.g.
unix:///run/nfd/nfd.sock). Returns None for face
types that don’t expose local binding info.Source§async fn recv(&self) -> Result<Bytes, FaceError>
async fn recv(&self) -> Result<Bytes, FaceError>
Receive the next packet. Blocks until a packet arrives or the face closes.
Source§async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
async fn send(&self, pkt: Bytes) -> Result<(), FaceError>
Send a packet. Must not block the caller; use internal buffering. Read more
Auto Trait Implementations§
impl<R, W, C> !Freeze for StreamFace<R, W, C>
impl<R, W, C> !RefUnwindSafe for StreamFace<R, W, C>
impl<R, W, C> Send for StreamFace<R, W, C>
impl<R, W, C> Sync for StreamFace<R, W, C>
impl<R, W, C> Unpin for StreamFace<R, W, C>
impl<R, W, C> UnwindSafe for StreamFace<R, W, C>
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