pub trait PacketPool: 'static {
type Packet: Packet;
const MTU: usize;
// Required methods
fn allocate() -> Option<Self::Packet>;
fn capacity() -> usize;
}
Expand description
A Packet Pool that can allocate packets of the desired size.
The MTU is usually related to the MTU of l2cap payloads.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn allocate() -> Option<Self::Packet>
fn allocate() -> Option<Self::Packet>
Allocate a new buffer with space for MTU
bytes.
Return None
when the allocation can’t be fulfilled.
This function is called by the L2CAP driver when it needs
space to receive a packet into.
It will later call from_raw_parts
with the buffer and the
amount of bytes it has received.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.