bacnet_types/lib.rs
1#![doc = include_str!("../README.md")]
2// Tests always build with std, so feature-off test runs need no imports of
3// their own.
4#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
5#![forbid(unsafe_code)]
6
7// `format!` and `vec!` without std's prelude. Without `alloc` the crate
8// links no allocator at all (#1614).
9#[cfg(feature = "alloc")]
10#[macro_use]
11extern crate alloc;
12
13#[cfg(feature = "std")]
14pub mod bip_port;
15pub mod bitstring;
16// Matches the constructed calendar types, which need alloc.
17#[cfg(feature = "alloc")]
18pub mod calendar;
19#[cfg(feature = "alloc")]
20pub mod constructed;
21pub mod data_link;
22pub mod enums;
23pub mod error;
24pub mod map_hash;
25pub mod network_number;
26pub mod primitives;
27
28/// BACnet MAC address — stack-allocated for typical sizes (≤6 bytes).
29///
30/// The data links this stack serves use 1-octet (MS/TP), 3-octet (the
31/// B/IPv6 VMAC) and 6-octet (B/IP, Ethernet, the B/SC VMAC) MACs, so SmallVec
32/// keeps every one of them inline. Only with `alloc`.
33#[cfg(feature = "alloc")]
34pub type MacAddr = smallvec::SmallVec<[u8; 6]>;