pub trait Protocol:
Typename
+ Debug
+ Send
+ Sync {
// Required methods
fn from_etf_map_validated(map: TermMap) -> Result<Self, Error>
where Self: Sized;
fn to_etf_bin(&self) -> Result<Vec<u8>, Error>;
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
src: Ipv4Addr,
) -> Pin<Box<dyn Future<Output = Result<Vec<Instruction>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn send_to_with_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
dst: Ipv4Addr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Every object that has this trait must be convertible from an Erlang ETF Binary representation and must be able to handle itself as a message
Required Methods§
fn from_etf_map_validated(map: TermMap) -> Result<Self, Error>where
Self: Sized,
Sourcefn to_etf_bin(&self) -> Result<Vec<u8>, Error>
fn to_etf_bin(&self) -> Result<Vec<u8>, Error>
Convert to ETF binary format for network transmission
Sourcefn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
src: Ipv4Addr,
) -> Pin<Box<dyn Future<Output = Result<Vec<Instruction>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
src: Ipv4Addr,
) -> Pin<Box<dyn Future<Output = Result<Vec<Instruction>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a message returning instructions for upper layers
Provided Methods§
Sourcefn send_to_with_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
dst: Ipv4Addr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_to_with_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
dst: Ipv4Addr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send this protocol message to a destination using encrypted format (v1.1.7+) REQUIRES ANR to be available - use send_to_legacy_with_metrics for bootstrap messages