//! Implementations of [`coap_message`] traits based on a serialized messages.
//!
//! The main structs of this modules are:
//!
//! * [`Message`]
//! * [`MessageMut`]
//!
//! They give access to the CoAP message semantics through the [`ReadableMessage`] and
//! [`MinimalWritableMessage`] / [`MutableWritableMessage`] traits. Its data is stored in buffers
//! defined in this module, which can be thought of as mostly an
//! [`AsRef<[u8]>`][core::convert::AsRef] / [`AsMut`] (i.e., data that can be owned or borrowed),
//! but with a separate code and options-and-payloads bytes:
//!
//! * [`MessageBuffer`] (e.g. [`SliceBuffer`])
//! * [`MessageBufferMut`] (e.g. [`SliceBufferMut`])
#![cfg_attr(feature = "downcast", allow(unsafe_code))]

// Needed by various modules
use coap_message::{
    MinimalWritableMessage, MutableWritableMessage, ReadableMessage, WithSortedOptions,
};

mod buffer_impl;
#[cfg(feature = "alloc")]
mod buffer_impl_alloc;
mod buffer_traits;
mod iterators;
mod read_impl;
mod write_impl;

pub use super::error::WriteError;
pub use buffer_impl::*;
#[cfg(feature = "alloc")]
pub use buffer_impl_alloc::*;
pub use buffer_traits::*;
pub use iterators::*;
pub use read_impl::*;
pub use write_impl::MessageMut;
