pub enum SchemaKey<'a> {
Tag(&'a str),
Node(NodeType),
}Expand description
What a schema lookup is keyed by: a tag by its name, a node by its type.
Upstream’s findSchema branches on whether node.tag is set, and so does
for_node. A tag node is never looked up by its
type, even though tag is one: the tag’s name is the key, and a source
that defines no schema for that name has defined nothing for the node.
Exhaustive, unlike the other public enums in this crate. Those grow with
Markdoc; this one has the two variants a node can be looked up by, and no
third is foreseen. An implementation of SchemaSource matches both, so
that if a third way ever did appear it would fail to compile in every
implementation rather than silently answer None – a schema that never
applies is the failure hardest to see from outside.
Variants§
Implementations§
Trait Implementations§
impl<'a> Copy for SchemaKey<'a>
impl<'a> Eq for SchemaKey<'a>
impl<'a> StructuralPartialEq for SchemaKey<'a>
Auto Trait Implementations§
impl<'a> Freeze for SchemaKey<'a>
impl<'a> RefUnwindSafe for SchemaKey<'a>
impl<'a> Send for SchemaKey<'a>
impl<'a> Sync for SchemaKey<'a>
impl<'a> Unpin for SchemaKey<'a>
impl<'a> UnsafeUnpin for SchemaKey<'a>
impl<'a> UnwindSafe for SchemaKey<'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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.