matter_codec/lib.rs
1//! Matter TLV (Tag-Length-Value) encoding and decoding.
2//!
3//! This is Milestone 1 of the `matter-rust` roadmap.
4//!
5//! # Scope
6//!
7//! Phases 1-4 (complete, shipping as `matter-codec` 0.1.0): all scalar
8//! element types, UTF-8 and octet strings, every tag form (anonymous,
9//! context, common profile, implicit profile, fully-qualified), and
10//! containers (structure, array, list) with recursive tree-builder
11//! decoding and a 32-level depth limit. Verified by spec test vectors,
12//! a `proptest` round-trip property, and a `cargo-fuzz` target.
13//!
14//! # Usage
15//!
16//! ```
17//! use matter_codec::{Tag, TlvWriter};
18//! # fn main() -> Result<(), matter_codec::Error> {
19//! let mut bytes = Vec::new();
20//! let mut writer = TlvWriter::new(&mut bytes);
21//! writer.put_bool(Tag::Anonymous, true)?;
22//! assert_eq!(bytes, [0x09]);
23//! # Ok(())
24//! # }
25//! ```
26
27#![forbid(unsafe_code)]
28
29mod element_type;
30mod tag_control;
31
32pub mod error;
33pub mod reader;
34pub mod tag;
35pub mod value;
36pub mod writer;
37
38pub use error::{Error, Result};
39pub use reader::{ContainerKind, Element, ElementRef, ElementSpan, TlvReader, MAX_DEPTH};
40pub use tag::Tag;
41pub use value::{Value, ValueRef};
42pub use writer::TlvWriter;