pub trait HasLength {
// Required method
fn length(&self) -> usize;
}Expand description
A value with a measurable length, used by the length rules.
Implement this for your own container types to make them eligible for
NonEmpty, MinLen, MaxLen, and LenRange.
§Examples
use type_lib::rules::HasLength;
assert_eq!("héllo".length(), 5); // chars, not bytes
assert_eq!([1, 2, 3][..].length(), 3);Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".