1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! BACnet protocol types per ASHRAE 135-2020.
//!
//! This crate provides the foundational types for the BACnet protocol:
//! enumerations, primitive data types, addresses, and error types.
//!
//! Its runtime dependencies are `bitflags`, `smallvec` and `thiserror`.
//!
//! Every enum newtype implements `FromStr`, accepting any common case style
//! (`analog-input`, `AnalogInput`, `ANALOG_INPUT`, ...) for its named
//! constants. The optional `serde` feature adds `Deserialize` for
//! [`enums::ObjectType`] and [`enums::PropertyIdentifier`] on top of it.
//!
//! # Features
//!
//! The crate needs an allocator, and one of these features to say so:
//!
//! - `std` (default): hosted builds. Adds the transport I/O error
//! (`Error::Transport`) and the B/IP port contract (`bip_port`).
//! - `alloc`: `no_std` with a global allocator, for bare-metal targets:
//! `default-features = false, features = ["alloc"]`.
//!
//! A build with neither fails; that combination is reserved for a future
//! allocation-free subset.
// Tests always build with std, so feature-off test runs need no imports of
// their own.
// bacnet-encoding and bacnet-services pass their feature on to this crate, so
// with neither on they stop here, before their own check can run.
compile_error!;
// `format!` and `vec!` without std's prelude.
extern crate alloc;
/// BACnet MAC address — stack-allocated for typical sizes (≤6 bytes).
///
/// The data links this stack serves use 1-octet (MS/TP), 3-octet (the
/// B/IPv6 VMAC) and 6-octet (B/IP, Ethernet, the B/SC VMAC) MACs, so SmallVec
/// keeps every one of them inline.
pub type MacAddr = SmallVec;