pub trait MessageBuffer {
// Required methods
fn code(&self) -> u8;
fn tail(&self) -> &[u8];
// Provided method
fn static_variant( ) -> Option<LifetimesMatterLittle<impl 'static + MessageBuffer>> { ... }
}Expand description
A trait that can implemented on in-memory encoded CoAP messages; then, an Message struct
can be placed around the implementer to implement ReadableMessage.
Implementations must not alter the content returned by the accessors. As this trait is safe to
implement, the content of the returned slice might change between calls even when the encoded
message was owned or exclusively referenced (e.g. when backed by a
RefCell). Therefore, neither this crate nor others can rely on
the content upholding any unsafe guarantees – but it may (and should) panic rater than erring
if the expectation of stable content is violated.
Required Methods§
Provided Methods§
fn static_variant() -> Option<LifetimesMatterLittle<impl 'static + MessageBuffer>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Implementors§
impl MessageBuffer for BoxBuffer
Available on crate feature
alloc only.