Struct preserves_schema::support::interpret::Context

source ·
pub struct Context<'a, V: NestedValue> {
    pub env: &'a Env<V>,
    /* private fields */
}
Expand description

Context for a given interpretation of a Schema.

Fields§

§env: &'a Env<V>

Implementations§

source§

impl<'a, V: NestedValue> Context<'a, V>

source

pub fn new(env: &'a Env<V>) -> Self

Construct a new Context with the given Env.

source

pub fn dynamic_parse( &mut self, module: &Vec<String>, name: &str, v: &V ) -> Option<V>

Parse v using the rule named name from the module at path module in self.env. Yields Some(...) if the parse succeeds, and None otherwise.

Trait Implementations§

source§

impl<'a, V: Debug + NestedValue> Debug for Context<'a, V>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, V> Freeze for Context<'a, V>

§

impl<'a, V> RefUnwindSafe for Context<'a, V>
where V: RefUnwindSafe,

§

impl<'a, V> Send for Context<'a, V>
where V: Sync,

§

impl<'a, V> Sync for Context<'a, V>
where V: Sync,

§

impl<'a, V> Unpin for Context<'a, V>

§

impl<'a, V> UnwindSafe for Context<'a, V>
where V: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<L, N> Codec<N> for L
where N: NestedValue,

source§

fn parse<'a, T>(&'a self, value: &N) -> Result<T, ParseError>
where T: Parse<&'a L, N>,

Delegates to T::parse, using self as language and the given value as input.
source§

fn unparse<'a, T>(&'a self, value: &T) -> N
where T: Unparse<&'a L, N>,

Delegates to value.unparse, using self as language.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.