pub enum NodeRegion {
Argument(usize),
Slot(usize),
}Expand description
A node region: one argument or one content slot of a node, given by
position, which a rule passes, with the node’s address, to
Lowerer::lower_region to have that region’s content lowered.
A node’s children are divided into node regions: one per argument the
node’s element declares, and one per content slot (a node slot in techy’s
sense, ParsedSlot: a part of a node’s content outside its arguments; the
body is one). Positions count from zero in the order in
which the element declares them. An argument’s position counts the
optional arguments an author left out, so a position designates the same
argument in every node of one element. NodeRegion::argument_named finds
an argument’s position from its name.
Variants§
Implementations§
Source§impl NodeRegion
impl NodeRegion
Sourcepub fn argument_named(node: &NodeRef<'_, Flm>, name: &str) -> Option<NodeRegion>
pub fn argument_named(node: &NodeRef<'_, Flm>, name: &str) -> Option<NodeRegion>
Returns the node region of node’s argument named name, or None
when node’s element declares no argument of that name.
Sourcepub fn content_nodes<'t>(
&self,
node: &NodeRef<'t, Flm>,
) -> Option<Vec<NodeRef<'t, Flm>>>
pub fn content_nodes<'t>( &self, node: &NodeRef<'t, Flm>, ) -> Option<Vec<NodeRef<'t, Flm>>>
Returns the content nodes of this node region of node, in the order
in which they are written: the argument’s or the slot’s content
without its delimiters, comments and whitespace included. An argument
that is absent (NodeRegion::is_absent) has no content, and the
result is empty.
Returns None when node has no argument or no slot at this position.
Sourcepub fn is_absent(&self, node: &NodeRef<'_, Flm>) -> bool
pub fn is_absent(&self, node: &NodeRef<'_, Flm>) -> bool
Returns whether this node region is an argument of node that is
absent from the source: an optional argument the author left out, or a
mandatory one that the parser left out after reporting it. An argument
written with nothing in it is not absent. A content slot is never absent,
and neither is a node region that node does not have.
Trait Implementations§
Source§impl Clone for NodeRegion
impl Clone for NodeRegion
impl Copy for NodeRegion
Source§impl Debug for NodeRegion
impl Debug for NodeRegion
Source§impl Display for NodeRegion
impl Display for NodeRegion
impl Eq for NodeRegion
Source§impl Hash for NodeRegion
impl Hash for NodeRegion
Source§impl PartialEq for NodeRegion
impl PartialEq for NodeRegion
impl StructuralPartialEq for NodeRegion
Auto Trait Implementations§
impl Forget for NodeRegion
impl Freeze for NodeRegion
impl Move for NodeRegion
impl RefUnwindSafe for NodeRegion
impl Send for NodeRegion
impl Sync for NodeRegion
impl Unpin for NodeRegion
impl UnsafeUnpin for NodeRegion
impl UnwindSafe for NodeRegion
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more