Skip to main content

NetworkSend

Trait NetworkSend 

Source
pub trait NetworkSend {
    // Required method
    async fn send_to(&mut self, data: &[u8], addr: Address) -> Result<(), Error>;
}
Expand description

A trait for sending data to a network address.

All network communication in the Matter transport is packetized (including via TCP and Bluetooth), hence this trait models the sending of a single Matter packet of data to a network address.

Data packetization is expected to be handled by the implementation of this trait, and is trivial for e.g. the UDP transport which is packetized by default, but more complex for e.g. the TCP transport and especially for BTP.

Required Methods§

Source

async fn send_to(&mut self, data: &[u8], addr: Address) -> Result<(), Error>

Send a Matter packet represented as a sequence of bytes (data) to the specified address.

Might return an error if the address is not supported, or if there is a general error on the network interface.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> NetworkSend for &mut T
where T: NetworkSend,

Source§

fn send_to( &mut self, data: &[u8], addr: Address, ) -> impl Future<Output = Result<(), Error>>

Implementors§