Skip to main content

Xnotes

Struct Xnotes 

Source
pub struct Xnotes {
    pub by_kind: BTreeMap<Name, Vec<XnoteRecord>>,
    /* private fields */
}
Expand description

The table of xnotes (XNOTES, flm.xnotes), which contains a record (XnoteRecord) for each xnote of the document, grouped by xnote kind.

The collect stage COLLECT writes this table. It finds the xnotes in the table of reference points (REFPOINTS). An xnote is a reference point whose reference kind is the name of an xnote kind, immediately followed on the same node by a reference point of the reference kind <kind>-mark. The function ref_points returns these two reference points. The xnotes that the elements of other features carry are therefore recorded in the same way as the xnotes written with \footnote.

The records of each xnote kind are in document order, which is the order of RefPoints::in_document_order. A node can carry several xnotes, of one xnote kind or of several. Each xnote has a record of its own, and the records of one node are in the order of its reference points.

Every xnote kind of the registry (every kind in the service slot KINDS_SLOT) has an entry in by_kind. This entry is empty if the document contains no xnote of the kind.

The table contains records only for the nodes of the document trees. A node of a synthesized value has no record. When content is copied to be shown again, for instance the title of a heading that a reference displays, each node that carries xnotes is replaced in the copy by a MarkOf node. This node finds the records of the original xnotes with records_written_at.

The table also contains the content of the fixed mark of each unnumbered xnote kind (fixed_mark). These marks are compiled once, when the registry is built. The collect stage copies them into the table so that the lowering rules, which have no access to the registry, can read them.

Fields§

§by_kind: BTreeMap<Name, Vec<XnoteRecord>>

The records of the xnotes, by the name of their xnote kind. The records of each kind are in document order.

Implementations§

Source§

impl Xnotes

Source

pub fn of_kind(&self, kind: &str) -> &[XnoteRecord]

Returns the records of the xnote kind kind, in document order. Returns an empty slice if the document contains no xnote of this kind, and if kind is not the name of an xnote kind.

Source

pub fn record_at(&self, addr: NodeAddr) -> Option<(&Name, &XnoteRecord)>

Returns the record of an xnote that the node at addr carries, together with the name of its xnote kind. Returns None if the table contains no record for this node: the node carries no xnote, or it is not a node of a document tree.

If the node carries several xnotes, this method returns the first record of the xnote kind whose name comes first in the order of the names. To obtain the records of one xnote kind for a node, call records_at.

Source

pub fn records_at( &self, kind: &str, addr: NodeAddr, ) -> impl Iterator<Item = &XnoteRecord>

Returns the records of the xnotes of the kind kind that the node at addr carries, in the order of the reference points of the node. The first record belongs to the first xnote of this kind on the node, whose content is the first region of this kind that the XnoteSource aspect of the node returns, and so on. Returns an empty iterator if the table contains no record of this kind for the node.

Source

pub fn records_written_at<'s>( &'s self, kind: &str, span: &'s FlmSpan, ) -> impl Iterator<Item = &'s XnoteRecord>

Returns the records of the xnote kind kind whose node was written at span, in document order. A record matches if the span of its node covers the same range of the same source as span. Returns an empty iterator if no xnote of this kind was written at span.

Use this method to find the xnotes of a copied node. A copy of a node keeps the span of the original node, but it has an address of its own, for which the table contains no record. For instance, a MarkOf node, which replaces a node that carries xnotes in a copy of content shown again, finds the records of these xnotes with this method.

Source

pub fn is_empty(&self) -> bool

Returns true if the table contains no record.

Source

pub fn fixed_mark(&self, kind: &str) -> &[Arc<NodeTree<Flm>>]

Returns the content of the fixed mark of the unnumbered xnote kind kind. The fixed mark is the mark template of the kind, which contains no number and is therefore the same for every xnote of the kind. It is compiled as FLM text when the registry is built.

The content is a list of synthesized values, which a lowering rule inserts into its output with Lowerer::splice. stage_mark_text writes the mark of an xnote of any kind, numbered or not.

Returns an empty slice for a kind with an empty mark, for a numbered kind, and if kind is not the name of an xnote kind of the registry.

Trait Implementations§

Source§

impl Clone for Xnotes

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Xnotes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Xnotes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Xnotes

Source§

impl PartialEq for Xnotes

Source§

fn eq(&self, other: &Xnotes) -> bool

Compares the records only. The fixed marks are not compared, because they depend only on the registry.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl SingletonTable for Xnotes

Source§

const NAME: &'static str = "flm.xnotes"

The name of the one table that uses this value type.
Source§

fn table_name() -> TableName<Self>
where Self: Sized,

The typed table key (TableName) of that one table.
Source§

impl Table for Xnotes

Source§

fn absorb(&mut self, piece: Xnotes)

Appends the records of piece after the records of self, kind by kind. The fixed marks are the same in every table piece: if piece has fixed marks, they replace those of self.

Source§

fn project(&self, cx: &dyn ProjectCx) -> SerialValue

Serializes the table as a map from the name of each xnote kind, in the order of the names, to the list of its records, in document order. Each record is a map with two keys: point, the key of the reference point of the xnote, and mark, the key of the reference point of its mark. A reference point has the key <node>#<index>, as in the serialized table of reference points. The other fields of the records and the fixed marks are not serialized.

Source§

fn piece_class(&self) -> PieceClass

Classifies self, taken as a table piece: see PieceClass. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Xnotes

§

impl !UnwindSafe for Xnotes

§

impl Forget for Xnotes

§

impl Freeze for Xnotes
where *const LeafNode<Name, Vec<XnoteRecord>> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(Name, Vec<XnoteRecord>)>>: Freeze, *const ArcInner<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>> is !null: Freeze, PhantomData<ArcInner<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>>>: Freeze,

§

impl Move for Xnotes

§

impl Send for Xnotes
where NodeRef<Owned, Name, Vec<XnoteRecord>, LeafOrInternal>: Send, BoxRaw<(Name, Vec<XnoteRecord>)>: Send, Arc<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>>: Send,

§

impl Sync for Xnotes
where NodeRef<Owned, Name, Vec<XnoteRecord>, LeafOrInternal>: Sync, BoxRaw<(Name, Vec<XnoteRecord>)>: Sync, Arc<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>>: Sync,

§

impl Unpin for Xnotes

§

impl UnsafeUnpin for Xnotes
where *const LeafNode<Name, Vec<XnoteRecord>> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(Name, Vec<XnoteRecord>)>>: UnsafeUnpin, *const ArcInner<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<BTreeMap<Name, Vec<Arc<NodeTree<Flm>>>>>>: UnsafeUnpin,

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

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
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> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> 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> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.