pub struct LoweredAddr {
pub tree: TreeId,
pub index: u32,
}Expand description
The address of a node of a lowered tree: the document tree it was lowered from, and the node’s position in that tree’s lowered form (its index in storage order).
It is not a NodeAddr, which identifies a
node of a frozen tree, for two reasons. A lowered node may have no
frozen counterpart: a rule may synthesize nodes that represent no single
frozen node, and a lowered tree stores no map back to the frozen one. And
the node identifiers techy assigns carry a per-tree tag that differs from
run to run, whereas a position is the same in two runs over the same
document. An address is looked up in the lowered-trees table with
resolve. The text backend’s position marks
(TextMark::addr) are
addresses of this kind.
§Examples
use flm_core::model::addr::TreeId;
use flm_core::stdlib::backends::lowering::LoweredAddr;
let addr = LoweredAddr::at(TreeId::tree(0), 5);
assert_eq!(addr.to_string(), "tree#0/5");Fields§
§tree: TreeIdThe document tree whose lowered form holds the node.
index: u32The node’s index in the lowered tree’s storage order.
Implementations§
Source§impl LoweredAddr
impl LoweredAddr
Sourcepub fn new(tree: TreeId, node: NodeId) -> LoweredAddr
pub fn new(tree: TreeId, node: NodeId) -> LoweredAddr
The address of the node node in the lowered form of the document tree
tree.
node must be a node of that lowered tree. Nothing checks it here: an
identifier from another tree gives the address of a different
position.
Sourcepub const fn at(tree: TreeId, index: u32) -> LoweredAddr
pub const fn at(tree: TreeId, index: u32) -> LoweredAddr
The address of the node at index in storage order in the lowered form
of the document tree tree.
Sourcepub fn resolve<'t>(&self, trees: &'t LoweredTrees) -> Option<NodeRef<'t, Flm>>
pub fn resolve<'t>(&self, trees: &'t LoweredTrees) -> Option<NodeRef<'t, Flm>>
The node at this address, looked up in trees.
Returns None when trees holds no lowered form of this address’s
document tree (its lowering failed, or the backend never lowered it), or
when that lowered tree has no node at this position.
Trait Implementations§
Source§impl Clone for LoweredAddr
impl Clone for LoweredAddr
impl Copy for LoweredAddr
Source§impl Debug for LoweredAddr
impl Debug for LoweredAddr
Source§impl Display for LoweredAddr
impl Display for LoweredAddr
impl Eq for LoweredAddr
Source§impl Hash for LoweredAddr
impl Hash for LoweredAddr
Source§impl Ord for LoweredAddr
impl Ord for LoweredAddr
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for LoweredAddr
impl PartialEq for LoweredAddr
Source§impl PartialOrd for LoweredAddr
impl PartialOrd for LoweredAddr
impl StructuralPartialEq for LoweredAddr
Auto Trait Implementations§
impl Forget for LoweredAddr
impl Freeze for LoweredAddr
impl Move for LoweredAddr
impl RefUnwindSafe for LoweredAddr
impl Send for LoweredAddr
impl Sync for LoweredAddr
impl Unpin for LoweredAddr
impl UnsafeUnpin for LoweredAddr
impl UnwindSafe for LoweredAddr
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> Comparable<K> for Q
impl<Q, K> Comparable<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
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