pub trait Len<L> {
// Required methods
fn len(&self) -> L;
fn len_into_u64(len: L) -> u64;
fn zero_len() -> L;
}
Expand description
Types for values that have a length.
At present, these are:
type | length description |
---|---|
&str , String | length in bytes |
Vec<T> | number of elements in the vector |
HashMap<K, V> , BTreeMap<K, V> | number of key/value pairs in the map |
TempFile | length of the file in bytes |
Option<T> where T: Len | length of T or 0 if None |
form::Result<'_, T> | length of T or 0 if Err |
Required Methods§
Sourcefn len_into_u64(len: L) -> u64
fn len_into_u64(len: L) -> u64
Convert len
into u64
.
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.
Implementations on Foreign Types§
Implementors§
impl Len<u64> for TempFile<'_>
impl Len<usize> for String
impl Len<ByteUnit> for TempFile<'_>
impl<K, V> Len<usize> for BTreeMap<K, V>
impl<K, V> Len<usize> for HashMap<K, V>
impl<L, T: Len<L>> Len<L> for Option<T>
impl<L, T: Len<L>> Len<L> for Capped<T>
impl<L, T: Len<L>> Len<L> for Json<T>
Available on crate feature
json
only.impl<L, T: Len<L>> Len<L> for MsgPack<T>
Available on crate feature
msgpack
only.