Crate maxlen

Source
Expand description

§maxlen

crates.io docs.rs

Length-bounded wrappers over standard types.

This crate provides several types that enforce length limits at the type level:

  • BSlice<T, MAX> is a [T] but guaranteed to not have more than MAX elements.
  • BVec<T, MAX> is a Vec<T> but guaranteed to not have more than MAX elements.
  • BStr<MAX, E> is a str but guarantees that the text will not be longer than MAX bytes in the specified encoding (not necessarily UTF-8).
  • BString<MAX, E> is a String but guarantees that the text will not be longer than MAX bytes in the specified encoding (not necessarily UTF-8).

Modules§

encoding
Different string encodings

Macros§

bslice
Creates a static &'static BSlice<T, MAX> with a compile-time check.
bstr
Creates a static &'static BStr<MAX, E> with a compile-time check.
bvec
Creates a BVec<T, MAX> with a compile-time check.

Structs§

BSlice
Bounded [T].
BStr
Bounded str.
BString
Bounded String.
BVec
Bounded Vec.
LengthExceeded
Length exceeded error.