Struct quire::validate::Enum[][src]

pub struct Enum<'a> { /* fields omitted */ }

Enum validator

This validates that the value is enum in the rust meaning of enum.

Enumeration can contain:

  • A selection from constants: enum T {a, b, c}, if you enable allow_plain(), this allows to select both as scalar value a and as a tag with null value !a

  • A set of different values with their own data: enum T { a(x), b(y) }. In this case value must be specified with tag !a "hello" and may contain different types inside !b ["x", "y"] or !c {x: y}. Only one enum field is supported. Structure enums enum T { a { x: u8 } are equivalent to an option with that struct as single value struct A { x: u8 }; enum T { a(A) }

Methods

impl<'a> Enum<'a>
[src]

For variants that have no content (i.e. have validator of Nothing)

Set plain default value (i.e. option that have validator of Nothing)

There is no way to set default to something complex at the moment

Trait Implementations

impl<'a> Debug for Enum<'a>
[src]

Formats the value using the given formatter. Read more

impl<'a> Validator for Enum<'a>
[src]

Auto Trait Implementations

impl<'a> !Send for Enum<'a>

impl<'a> !Sync for Enum<'a>