pub struct BlockingForwarderClient { /* private fields */ }Expand description
Synchronous (blocking) client for communicating with a running ndn-fwd.
Wraps ForwarderClient with a private Tokio runtime so callers do not
need to manage an async runtime. All methods block the calling thread.
Implementations§
Source§impl BlockingForwarderClient
impl BlockingForwarderClient
Sourcepub fn connect(face_socket: impl AsRef<Path>) -> Result<Self, ForwarderError>
pub fn connect(face_socket: impl AsRef<Path>) -> Result<Self, ForwarderError>
Connect to the forwarder’s face socket (blocking).
Automatically attempts SHM data plane; falls back to Unix socket.
§Errors
Returns ForwarderError if the socket is unreachable or the
connection handshake fails.
Sourcepub fn connect_unix_only(
face_socket: impl AsRef<Path>,
) -> Result<Self, ForwarderError>
pub fn connect_unix_only( face_socket: impl AsRef<Path>, ) -> Result<Self, ForwarderError>
Connect using only the Unix socket for data (no SHM attempt).
Sourcepub fn send(&self, pkt: Bytes) -> Result<(), ForwarderError>
pub fn send(&self, pkt: Bytes) -> Result<(), ForwarderError>
Send a raw NDN packet (blocking).
Sourcepub fn recv(&self) -> Option<Bytes>
pub fn recv(&self) -> Option<Bytes>
Receive a raw NDN packet (blocking).
Returns None if the forwarder connection is closed.
Sourcepub fn register_prefix(&self, prefix: &Name) -> Result<(), ForwarderError>
pub fn register_prefix(&self, prefix: &Name) -> Result<(), ForwarderError>
Register a prefix with the forwarder (blocking).
Sourcepub fn unregister_prefix(&self, prefix: &Name) -> Result<(), ForwarderError>
pub fn unregister_prefix(&self, prefix: &Name) -> Result<(), ForwarderError>
Unregister a prefix from the forwarder (blocking).
Auto Trait Implementations§
impl !Freeze for BlockingForwarderClient
impl !RefUnwindSafe for BlockingForwarderClient
impl Send for BlockingForwarderClient
impl Sync for BlockingForwarderClient
impl Unpin for BlockingForwarderClient
impl !UnwindSafe for BlockingForwarderClient
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