small_fixed_array/
lib.rs

1//! A crate for [`FixedArray`] and [`FixedString`], types to provide a smaller memory footprint in exchange for:
2//! - Immutablity, [`FixedArray`] and [`FixedString`] cannot be mutated without converting back to their expanded forms.
3//! - Maximum length, [`FixedArray`] and [`FixedString`] have a length cap of `LenT::MAX` elements.
4//!
5//! These types provide cheap conversions to [`Vec`] and [`String`], to make up for most of these downsides, but it is
6//! still not recommended to use these collections for mutated values as you will see a performance downside.
7//!
8//! These can be thought of as `Box<[T]>` and `Box<str>`, except the length is denoted as `LenT`, by default [`u32`].
9//!
10//! ## Features
11//! - `nightly`: Speeds up [`FixedString::len`] for small strings, using `portable_simd`.
12//! - `serde`: Provides [`serde`] implementations for [`FixedArray`] and [`FixedString`].
13//! - `typesize`: Provides [`typesize`] implementations for [`FixedArray`] and [`FixedString`].
14//!
15//! ## MSRV
16//! The Minimum Supported Rust Version of this crate is 1.70.
17//!
18//! It is considered a breaking change to raise this.
19#![cfg_attr(feature = "nightly", feature(portable_simd))]
20#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
21#![cfg_attr(not(feature = "std"), no_std)]
22#![cfg_attr(feature = "std", allow(unused_imports))]
23#![warn(clippy::pedantic, clippy::as_conversions)]
24#![allow(clippy::module_name_repetitions, unknown_lints)]
25
26extern crate alloc;
27
28mod array;
29mod inline;
30mod length;
31mod r#static;
32mod string;
33mod truncating_into;
34
35pub use array::FixedArray;
36pub use length::ValidLength;
37pub use string::FixedString;
38pub use truncating_into::TruncatingInto;