Trait rocket::form::validate::Len

source ·
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:

typelength description
&str, Stringlength in bytes
Vec<T>number of elements in the vector
HashMap<K, V>, BTreeMap<K, V>number of key/value pairs in the map
TempFilelength of the file in bytes
Option<T> where T: Lenlength of T or 0 if None
form::Result<'_, T>length of T or 0 if Err

Required Methods§

source

fn len(&self) -> L

The length of the value.

source

fn len_into_u64(len: L) -> u64

Convert len into u64.

source

fn zero_len() -> L

The zero value for L.

Implementations on Foreign Types§

source§

impl Len<usize> for String

source§

impl<K, V> Len<usize> for BTreeMap<K, V>

source§

impl<T> Len<usize> for Vec<T>

source§

impl<L, T: Len<L> + ?Sized> Len<L> for &T

source§

fn len(&self) -> L

source§

fn len_into_u64(len: L) -> u64

source§

fn zero_len() -> L

source§

impl<L, T: Len<L>> Len<L> for Option<T>

source§

fn len(&self) -> L

source§

fn len_into_u64(len: L) -> u64

source§

fn zero_len() -> L

source§

impl<K, V> Len<usize> for HashMap<K, V>

source§

impl Len<usize> for str

Implementors§

source§

impl Len<u64> for TempFile<'_>

source§

impl Len<ByteUnit> for TempFile<'_>

source§

impl<L, T: Len<L>> Len<L> for Capped<T>

source§

impl<L, T: Len<L>> Len<L> for Result<'_, T>