[][src]Trait verify::ValidateMap

pub trait ValidateMap<S: Span> {
    type Error: Error;
    fn with_span(&mut self, span: Option<S>) -> &mut Self;
fn validate_key<V: ?Sized>(&mut self, key: &V) -> Result<(), Self::Error>
    where
        V: Validate<Span = S>
;
fn validate_string_key<V: ?Sized>(
        &mut self,
        key: &V
    ) -> Result<(), Self::Error>
    where
        V: Validate<Span = S> + ToString
;
fn validate_value<V: ?Sized>(
        &mut self,
        value: &V
    ) -> Result<(), Self::Error>
    where
        V: Validate<Span = S>
;
fn end(self) -> Result<(), Self::Error>; fn validate_entry<K: ?Sized, V: ?Sized>(
        &mut self,
        key: &K,
        value: &V
    ) -> Result<(), Self::Error>
    where
        K: Validate<Span = S>,
        V: Validate<Span = S>
, { ... }
fn validate_string_entry<K: ?Sized, V: ?Sized>(
        &mut self,
        key: &K,
        value: &V
    ) -> Result<(), Self::Error>
    where
        K: Validate<Span = S> + ToString,
        V: Validate<Span = S>
, { ... }
fn string_key_required(&self) -> bool { ... } }

Type returned by validate_map.

Associated Types

type Error: Error

The error returned by the validator.

Loading content...

Required methods

fn with_span(&mut self, span: Option<S>) -> &mut Self

Set the span for the current value that is being validated.

In some cases this is needed to ensure that the validator returns the correct span in its errors.

fn validate_key<V: ?Sized>(&mut self, key: &V) -> Result<(), Self::Error> where
    V: Validate<Span = S>, 

Validate a key in the map.

fn validate_string_key<V: ?Sized>(&mut self, key: &V) -> Result<(), Self::Error> where
    V: Validate<Span = S> + ToString

Validate a key in the map.

This method guarantees that the key is a string or has a string representation.

fn validate_value<V: ?Sized>(&mut self, value: &V) -> Result<(), Self::Error> where
    V: Validate<Span = S>, 

Validate a map entry.

fn end(self) -> Result<(), Self::Error>

End the map.

Loading content...

Provided methods

fn validate_entry<K: ?Sized, V: ?Sized>(
    &mut self,
    key: &K,
    value: &V
) -> Result<(), Self::Error> where
    K: Validate<Span = S>,
    V: Validate<Span = S>, 

Validate an entry (key and value).

fn validate_string_entry<K: ?Sized, V: ?Sized>(
    &mut self,
    key: &K,
    value: &V
) -> Result<(), Self::Error> where
    K: Validate<Span = S> + ToString,
    V: Validate<Span = S>, 

Validate an entry (key and value).

This method guarantees that the key is a string or has a string representation.

fn string_key_required(&self) -> bool

Some Validate implementors can convert map keys to strings. With this method redundant conversions can be avoided.

Loading content...

Implementors

Loading content...