Skip to main content

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#![cfg_attr(not(feature = "std"), no_std)]
10
11#[cfg(not(feature = "std"))]
12extern crate alloc;
13
14pub mod constructed;
15pub mod enums;
16pub mod error;
17pub mod primitives;
18
19/// BACnet MAC address — stack-allocated for typical sizes (≤6 bytes).
20///
21/// BACnet MAC addresses are 1 byte (MS/TP), 6 bytes (Ethernet/IP),
22/// 3 bytes (SC VMAC), or 18 bytes (BIP6 IP:port). SmallVec avoids
23/// heap allocation for the common cases.
24pub type MacAddr = smallvec::SmallVec<[u8; 6]>;