bacnet_types/lib.rs
1//! BACnet protocol types per ASHRAE 135-2020.
2//!
3//! This crate provides the foundational types for the BACnet protocol:
4//! enumerations, primitive data types, addresses, and error types.
5//!
6//! It has zero runtime dependencies beyond `bitflags` and `thiserror`,
7//! and supports `no_std` environments via the `std` feature flag.
8//!
9//! Every enum newtype implements `FromStr`, accepting any common case style
10//! (`analog-input`, `AnalogInput`, `ANALOG_INPUT`, ...) for its named
11//! constants. The optional `serde` feature adds `Deserialize` for
12//! [`enums::ObjectType`] and [`enums::PropertyIdentifier`] on top of it.
13
14#![cfg_attr(not(feature = "std"), no_std)]
15
16#[cfg(not(feature = "std"))]
17extern crate alloc;
18
19pub mod bitstring;
20pub mod calendar;
21pub mod constructed;
22pub mod data_link;
23pub mod enums;
24pub mod error;
25pub mod network_number;
26pub mod primitives;
27
28/// BACnet MAC address — stack-allocated for typical sizes (≤6 bytes).
29///
30/// BACnet MAC addresses are 1 byte (MS/TP), 6 bytes (Ethernet/IP),
31/// 3 bytes (SC VMAC), or 18 bytes (BIP6 IP:port). SmallVec avoids
32/// heap allocation for the common cases.
33pub type MacAddr = smallvec::SmallVec<[u8; 6]>;