Skip to main content

Merged

Struct Merged 

Source
pub struct Merged<'a> { /* private fields */ }
Expand description

A context definition viewed together with the definition it pulls in through @import.

The importing definition wins over the imported one for every entry, which is what the specification means by “merging context into import context, replacing common entries”. Reading through this type lets the algorithm treat the pair as one definition without building a merged copy.

Implementations§

Source§

impl<'a> Merged<'a>

Source

pub fn new(base: &'a Definition, imported: Option<Context>) -> Self

Views base together with the context it imports.

imported is the already-dereferenced @import target, or None when the definition has no @import.

Source

pub fn imported(&self) -> Option<&Definition>

Returns the imported context definition, if there is one.

Yields None when nothing was imported, and also when what was imported is not a single context definition object — a shape the caller has already rejected before reaching here.

Source

pub fn base(&self) -> Option<Nullable<&IriRefBuf>>

Returns the @base entry, falling back to the imported definition’s.

Source

pub fn vocab(&self) -> Option<Nullable<&Vocab>>

Returns the @vocab entry, falling back to the imported definition’s.

Source

pub fn language(&self) -> Option<Nullable<&LenientLangTagBuf>>

Returns the @language entry, falling back to the imported definition’s.

Source

pub fn direction(&self) -> Option<Nullable<Direction>>

Returns the @direction entry, falling back to the imported definition’s.

Source

pub fn protected(&self) -> Option<bool>

Returns the @protected entry, falling back to the imported definition’s.

This is the context-wide default applied to every term it defines, not the flag of an individual term definition.

Source

pub fn type_(&self) -> Option<Type>

Returns the @type entry, falling back to the imported definition’s.

@type is the one keyword a context may redefine, to give it an @set container or mark it protected.

Source

pub fn bindings(&self) -> MergedBindings<'_> ⓘ

Iterates over every term definition of both definitions, without repeating a term the importing definition overrides.

Source

pub fn get(&self, key: &KeyOrKeyword) -> Option<EntryValueRef<'_>>

Returns the entry bound to key, preferring the importing definition’s.

Trait Implementations§

Source§

impl<'a> From<&'a Definition> for Merged<'a>

Source§

fn from(base: &'a Definition) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for Merged<'a>

§

impl<'a> RefUnwindSafe for Merged<'a>

§

impl<'a> Send for Merged<'a>

§

impl<'a> Sync for Merged<'a>

§

impl<'a> Unpin for Merged<'a>

§

impl<'a> UnsafeUnpin for Merged<'a>

§

impl<'a> UnwindSafe for Merged<'a>

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<T> BorrowUnordered for T

Source§

fn as_unordered(&self) -> &Unordered<T>

Views this value as an Unordered reference.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, C> FromWithContext<T, C> for T

Source§

fn from_with(value: T, _context: &C) -> T

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, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

Source§

fn into_with(self, context: &C) -> U

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

Source§

type Error = !

Source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

Source§

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

Source§

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.
Source§

impl<T, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

Source§

type Error = <U as TryFromWithContext<T, C>>::Error

Source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

Source§

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

Source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

Source§

fn into_with<C>(self, context: C) -> Contextual<T, C>
where T: Sized,