rocket::form::validate

Trait 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.

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§

Source§

impl Len<usize> for str

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

Implementors§

Source§

impl Len<u64> for TempFile<'_>

Source§

impl Len<usize> for String

Source§

impl Len<ByteUnit> for TempFile<'_>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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