pub trait ErasedFace:
Send
+ Sync
+ 'static {
// Required methods
fn id(&self) -> FaceId;
fn kind(&self) -> FaceKind;
fn remote_uri(&self) -> Option<String>;
fn local_uri(&self) -> Option<String>;
fn send_bytes(
&self,
pkt: Bytes,
) -> Pin<Box<dyn Future<Output = Result<(), FaceError>> + Send + '_>>;
fn recv_bytes(
&self,
) -> Pin<Box<dyn Future<Output = Result<Bytes, FaceError>> + Send + '_>>;
fn recv_bytes_with_addr(
&self,
) -> Pin<Box<dyn Future<Output = Result<(Bytes, Option<FaceAddr>), FaceError>> + Send + '_>>;
}Expand description
Object-safe wrapper around the Face trait so it can be stored in the face table.
Required Methods§
fn id(&self) -> FaceId
fn kind(&self) -> FaceKind
fn remote_uri(&self) -> Option<String>
fn local_uri(&self) -> Option<String>
fn send_bytes( &self, pkt: Bytes, ) -> Pin<Box<dyn Future<Output = Result<(), FaceError>> + Send + '_>>
fn recv_bytes( &self, ) -> Pin<Box<dyn Future<Output = Result<Bytes, FaceError>> + Send + '_>>
Sourcefn recv_bytes_with_addr(
&self,
) -> Pin<Box<dyn Future<Output = Result<(Bytes, Option<FaceAddr>), FaceError>> + Send + '_>>
fn recv_bytes_with_addr( &self, ) -> Pin<Box<dyn Future<Output = Result<(Bytes, Option<FaceAddr>), FaceError>> + Send + '_>>
Object-safe version of Face::recv_with_addr.
Returns the raw packet together with the link-layer sender address
when the face type exposes it (e.g. multicast UDP). Returns None
for faces that receive from a single known peer.