Skip to main content

rustbac_core/
lib.rs

1//! BACnet protocol encoding and decoding in pure Rust.
2//!
3//! `rustbac-core` provides zero-copy, `no_std`-compatible encoding and decoding
4//! of BACnet APDUs, NPDUs, and service payloads. It forms the foundation of the
5//! rustbac crate family and can be used standalone in embedded or constrained
6//! environments.
7//!
8//! # Feature flags
9//!
10//! - **`std`** (default) — enables `std::error::Error` implementations.
11//! - **`alloc`** (default) — enables service decoders that allocate (e.g. RPM, COV).
12//! - **`serde`** — derives `Serialize`/`Deserialize` on core types.
13//! - **`defmt`** — derives `defmt::Format` for embedded logging.
14
15#![cfg_attr(not(feature = "std"), no_std)]
16
17#[cfg(feature = "alloc")]
18extern crate alloc;
19#[cfg(feature = "std")]
20extern crate std;
21
22/// APDU (Application Protocol Data Unit) types for confirmed/unconfirmed requests and responses.
23pub mod apdu;
24/// Binary encoding primitives, tag system, and zero-copy reader/writer.
25pub mod encoding;
26/// Error types for encoding and decoding operations.
27pub mod error;
28/// NPDU (Network Protocol Data Unit) encoding and decoding.
29pub mod npdu;
30/// BACnet service request and response codecs.
31pub mod services;
32/// Core BACnet data types: object identifiers, property identifiers, and data values.
33pub mod types;
34
35pub use error::{DecodeError, EncodeError};