pub trait LengthType:
Copy
+ Default
+ PartialOrd {
const SIZE: usize;
// Required methods
fn from_usize(value: usize) -> Option<Self>;
fn to_usize(self) -> usize;
}
Expand description
Trait for length types used in slice collections.
This trait defines the interface for length types that can be used to represent
the length of string cows. Implementations are provided for u8
, u16
, u32
, and u64
.
Required Associated Constants§
Required Methods§
Sourcefn from_usize(value: usize) -> Option<Self>
fn from_usize(value: usize) -> Option<Self>
Convert a usize value to this length type.
Returns None
if the value is too large to be represented by this length type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.