Expand description
§matter-model
The Matter data model as static lookup tables, and conversion between JSON and Matter TLV guided by them.
The tables are generated at build time from the Matter IDL that rs-matter
ships (the CSA’s controller-clusters.matter, from which the C++ SDK and
rs-matter generate their own cluster code), so nothing here is typed by
hand and a newer rs-matter brings newer clusters.
TLV is self-describing, so any value decodes to JSON even without a schema; the schema adds field names to structures and gives the encoder the signedness, string kind and field tags it cannot guess from JSON.
let on_off = matter_model::cluster_by_name("on_off").unwrap();
assert_eq!(on_off.id, 6);
assert_eq!(on_off.attribute_by_name("OnOff").unwrap().id, 0);Part of matter-bridge, maintained by Pulzar. See the user guide, the library guide and the API documentation.
License: MIT.
Structs§
- Attribute
- An attribute of a cluster.
- Bitmap
Def - A bitmap.
- Cluster
- A cluster: its attributes, commands and events.
- Command
- A command a server accepts.
- EnumDef
- An enumeration.
- Event
- An event of a cluster.
- Field
- A field of a structure, a command or an event.
- Shape
- What a value is expected to be: its type (if known) and whether it is a list of it.
- Struct
Def - A structure.
Enums§
- Convert
Error - Why a conversion failed.
- Type
- The type of a value, as far as JSON conversion needs it.
Constants§
- MAX_
DEPTH - The deepest nesting either direction accepts. Matter data is a handful of levels deep at most (a list of structures holding a list).
Statics§
- CLUSTERS
- Every cluster of the IDL, sorted by id.
Functions§
- cluster
- The cluster with
id, if the IDL has it. - cluster_
by_ name - The cluster named
name, compared without case or underscores, soOnOff,onOffandon_offall find the On/Off cluster. - encode_
to_ vec - Encode a JSON value as one anonymous TLV element, as
from_jsondoes, into a new buffer of at mostmax_lenbytes. - from_
json - Encode a JSON value as TLV under
tag, asshapesays it should be. - names_
match - Whether two IDL-style names are the same name: ignoring case and
_. - snake_
case - The
snake_caseform of an IDL name (OnOffandonOffgiveon_off), as used in MQTT topics. - to_json
- Decode a TLV element to JSON, naming structure fields from
shapewhere it has them.