Enum ezomyte::Quasi [] [src]

#[must_use]
pub enum Quasi<T, S = Json> { True(T), Substitute(S), }

Quasi-equivalent wrapper over a deserialized type.

Basically, Quasi<T> is simply wrapping T in the vast majority of cases. The only exception is when T couldn't be deserialized successfully, in which case the original source/subsititute representation (S) is made available.

Because Quasi<T> is essentially T, you'd normally just call the get method and work with the resulting &T reference directly. Alternatively, the wrapper itself offers an Option-like interface for safely accessing T. There is intentionally no equivalent interface to access the subsititute value outside of pattern matching.

Variants

The usual, "true" value.

The substitute, "fake", undeserialized value.

Methods

impl<T, S> Quasi<T, S>
[src]

[src]

Unwraps the container, yielding the underlying value.

Panics

Panics if it's a Substitute with a custom panic message provided by msg.

Important traits for &'a mut W
[src]

Get an immutable reference to the underlying type.

Panics

Panics if it's a Substitute.

Important traits for &'a mut W
[src]

Get a mutable reference to the underlying type.

Panics

Panics if it's a Substitute.

[src]

Moves the underyling value out of the Quasi container.

Panics

Panics if it's a Substitute.

impl<T, S> Quasi<T, S>
[src]

[src]

Returns an optional reference to the underlying value.

[src]

Returns an optional mutable reference to the underlying value.

Important traits for Box<W>
[src]

Returns an iterator over the one underlying value.

Important traits for Box<W>
[src]

Returns a mutable iterator over the one underlying value.

[src]

Returns the underlying value or a default.

[src]

Returns the underlying value or computes one from a closure.

impl<T: Default, S> Quasi<T, S>
[src]

[src]

Returns the underlying value or a default.

impl<T, S> Quasi<T, S>
[src]

[src]

Maps a Quasi<T> to Quasi<U> by applying a function to the underlying value.

Trait Implementations

impl<T, S> From<T> for Quasi<T, S>
[src]

[src]

Performs the conversion.

impl<T: Default, S> Default for Quasi<T, S>
[src]

[src]

Returns the "default value" for a type. Read more

impl<'de, T, S> Deserialize<'de> for Quasi<T, S> where
    T: Deserialize<'de>,
    S: Clone + Deserialize<'de> + IntoDeserializer<'de>, 
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

impl<T: FromStr> FromStr for Quasi<T, String>
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more

impl<T, S> Serialize for Quasi<T, S> where
    T: Serialize,
    S: Serialize
[src]

[src]

Serialize this value into the given Serde serializer. Read more

impl<T, S> Clone for Quasi<T, S> where
    T: Clone,
    S: Clone
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T, S> PartialEq for Quasi<T, S> where
    T: PartialEq,
    S: PartialEq
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<T, S> PartialOrd for Quasi<T, S> where
    T: PartialOrd,
    S: PartialOrd
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T, S> Into<Option<T>> for Quasi<T, S>
[src]

[src]

Performs the conversion.

impl<T, S> Into<Result<T, S>> for Quasi<T, S>
[src]

[src]

Performs the conversion.

impl<T, S> Debug for Quasi<T, S> where
    T: Debug,
    S: Debug
[src]

[src]

Formats the value using the given formatter. Read more

impl<T, S> Display for Quasi<T, S> where
    T: Display,
    S: Display
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<T, S> Send for Quasi<T, S> where
    S: Send,
    T: Send

impl<T, S> Sync for Quasi<T, S> where
    S: Sync,
    T: Sync