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>
impl<'a> Merged<'a>
Sourcepub fn new(base: &'a Definition, imported: Option<Context>) -> Self
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.
Sourcepub fn imported(&self) -> Option<&Definition>
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.
Sourcepub fn base(&self) -> Option<Nullable<&IriRefBuf>>
pub fn base(&self) -> Option<Nullable<&IriRefBuf>>
Returns the @base entry, falling back to the imported definition’s.
Sourcepub fn vocab(&self) -> Option<Nullable<&Vocab>>
pub fn vocab(&self) -> Option<Nullable<&Vocab>>
Returns the @vocab entry, falling back to the imported definition’s.
Sourcepub fn language(&self) -> Option<Nullable<&LenientLangTagBuf>>
pub fn language(&self) -> Option<Nullable<&LenientLangTagBuf>>
Returns the @language entry, falling back to the imported definition’s.
Sourcepub fn direction(&self) -> Option<Nullable<Direction>>
pub fn direction(&self) -> Option<Nullable<Direction>>
Returns the @direction entry, falling back to the imported
definition’s.
Sourcepub fn protected(&self) -> Option<bool>
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.
Sourcepub fn type_(&self) -> Option<Type>
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.
Sourcepub fn bindings(&self) -> MergedBindings<'_> ⓘ
pub fn bindings(&self) -> MergedBindings<'_> ⓘ
Iterates over every term definition of both definitions, without repeating a term the importing definition overrides.
Sourcepub fn get(&self, key: &KeyOrKeyword) -> Option<EntryValueRef<'_>>
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>
impl<'a> From<&'a Definition> for Merged<'a>
Source§fn from(base: &'a Definition) -> Self
fn from(base: &'a Definition) -> Self
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.