sigma_bounded/lib.rs
1//! Bounded [`Vec`], [`String`], and [`BTreeMap`] for `alloc` or [`heapless`].
2//!
3//! Part of the Sigma **`dbc-rs`** **embedded-first** story: pick **`alloc`** (default) or
4//! **`heapless`** (`default-features = false`) so firmware policy matches **`dbc-rs`** without
5//! duplicating collection wrappers elsewhere.
6
7// Embedded-first: always `no_std`. `alloc`-backed collections pull in the
8// `alloc` crate below; the `heapless` backend needs neither `std` nor `alloc`.
9// (Previously this was `no_std` only in the non-`alloc` build, which made the
10// `alloc` feature silently require `std` and broke bare-metal targets.)
11#![no_std]
12#![forbid(unsafe_code)]
13
14#[cfg(all(not(feature = "alloc"), not(feature = "heapless")))]
15compile_error!("Either the `alloc` or `heapless` feature must be enabled");
16
17#[cfg(feature = "alloc")]
18extern crate alloc;
19
20mod btree_map;
21pub mod error;
22mod string;
23mod vec;
24
25pub use btree_map::BTreeMap;
26pub use error::{Error, Result};
27pub use string::String;
28pub use vec::Vec;