diff --git a/README.md b/README.md index 449de78..2249eb7 100644 --- a/README.md +++ b/README.md @@ -249,6 +249,24 @@ assert_eq!(ucobs::decode(&[], &mut buf), Some(0)); // decodes to [] **Note:** The encoder does *not* append a trailing `0x00` sentinel. Append it yourself when framing for transport. +## Minimum Supported Rust Version + +The default build requires **Rust 1.93+** (for const `copy_from_slice`). + +### `legacy-msrv` feature + +If you're targeting a toolchain older than 1.93 (e.g. Xtensa), enable the +`legacy-msrv` feature to fall back to a manual byte copy in the encoder: + +```toml +[dependencies] +ucobs = { version = "0.3", features = ["legacy-msrv"] } +``` + +All other optimizations (sub-slice scan, zero fast path, decode batch fill) +are available regardless of this feature. Only the encode copy phase is +affected — it uses a byte loop instead of `copy_from_slice`/memcpy. + ## Testing μCOBS has one of the most thorough test suites of any COBS implementation — diff --git a/src/lib.rs b/src/lib.rs index d850907..b7a5044 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,12 @@ //! This crate is `no_std`, zero-alloc, and `unsafe`-free — it runs //! everywhere from 8-bit MCUs to servers. //! +//! # Feature flags +//! +//! - **`legacy-msrv`** — Enables compilation on Rust 1.83+ by replacing +//! the const `copy_from_slice` (requires Rust 1.93) with a manual byte +//! loop in the encoder. All other optimizations are unaffected. +//! //! # Quick start //! //! ```