smart-string 0.3.0

A collection of string types and traits designed for enhanced string manipulation.
Documentation
#![deny(unsafe_op_in_unsafe_fn)]

//! `smart-string` is a collection of small string primitives:
//!
//! - [`PascalString`]: fixed-capacity UTF-8 string stored inline (stack / in-place).
//! - [`SmartString`]: stack-or-heap string that promotes to heap when needed.
//! - [`StrStack`]: mutable builder for a compact list of string segments in a single byte buffer.
//! - [`StrList`]: frozen (immutable) string list with no excess capacity.
//! - [`StrListRef`]: borrowed read-only view over string list data (zero-copy).
//!
//! ## Notes
//!
//! - `SmartString` promotion (stack → heap) can happen implicitly during mutation when capacity is exceeded.
//! - Demotion (heap → stack) is **explicit** and must be requested via [`SmartString::try_into_stack`].
//!
//! ## Safety & invariants
//!
//! This crate contains a small amount of `unsafe` code used to project internal UTF‑8 byte buffers as `&str` / `&mut str`
//! without repeated validation and bounds checks.
//!
//! Soundness relies on internal invariants:
//!
//! - `PascalString`: `len <= CAPACITY` and `data[..len]` is always valid UTF‑8.
//! - `StrStack`: `data` is always valid UTF‑8 and `ends` stores valid UTF‑8 segment boundaries within `data`.
//!
//! See also: `docs/parity.api.md` for the “std `String` parity” checklist and compatibility notes.
//! - MSRV (default features): **Rust 1.59.0**.
//!   - Motivation: `SmartString`'s public API uses a default const generic parameter
//!     (`SmartString<const N: usize = DEFAULT_CAPACITY>`), which requires newer compilers.
//!   - Note: MSRV is a `rustc` guarantee for this crate. Without a committed `Cargo.lock`, transitive dependency MSRVs
//!     can drift over time; our CI runs an MSRV job to detect such drift.
mod display_ext;
pub mod pascal_string;
pub mod smart_string;
pub mod str_stack;

pub use crate::display_ext::DisplayExt;
pub use crate::pascal_string::PascalString;
pub use crate::smart_string::IntoChars;
pub use crate::smart_string::SmartString;
pub use crate::smart_string::Utf16DecodeError;
pub use crate::str_stack::Checkpoint;
pub use crate::str_stack::StrList;
pub use crate::str_stack::StrListIter;
pub use crate::str_stack::StrListRef;
pub use crate::str_stack::StrListValidationError;
pub use crate::str_stack::StrStack;
pub use crate::str_stack::StrStackIter;
pub use crate::str_stack::StrStackOverflow;