Skip to main content

NumberSource

Struct NumberSource 

Source
pub struct NumberSource {
    pub counter: Name,
    pub instances: Vec<NodeId>,
    pub style: Name,
    pub advance: Vec<u32>,
    pub number_format: Option<String>,
}
Expand description

What a reference point is numbered by: the counter it counts in, the counter style its number is shown in, the scoped instances it counts under, the levels of the counter it advances, and optionally a number template of its own.

A counter is a dotted name under which things are counted in document order (CounterDecl), and a counter style says how a counter value is shown (CounterStyleDecl). A point that is to carry a number gives a number source in RefPoint::number, and the numbering feature (numbering) numbers every point that gives one; no setting of the numbering feature turns numbering off for a point. A point that is not to carry a number gives none: a line of an equation* environment, a heading written with a star, a heading of a kind that the headings configuration does not number. The element decides from the node and from its feature’s configuration, fixed when the registry was built, since an aspect reads no option; the same document is therefore numbered the same way on every output.

The counter and the counter style are given by name. A point that gives a counter or a counter style that no feature declares is reported by the numbering stage, not here.

§Scoped instances

A point may count in a scoped instance of its counter rather than in the counter’s single sequence through the document. A scoped instance is an independent sequence of the counter’s values attached to a node, usually the environment the point is written in, and it covers exactly that node’s content: two sibling environments are two instances, and each starts again from the counter’s initial value. The point lists the instances it counts under in instances, outermost first, the last being its own. An instance inside another is numbered within the current value of the enclosing instance, so the item of a nested list reads 2.(b) or (b) depending on what the counter writes for its enclosing levels. The numbering guide describes the whole mechanism.

Fields§

§counter: Name

The name of the counter the point counts in, such as flm.headings.section or flm.math.equation. The feature that declares the counter owns its name; points of several reference kinds, from any feature, may count in one counter.

§instances: Vec<NodeId>

The scoped instances of the counter that the point counts under, outermost first: nodes of the tree of the node the aspect was asked about, which contain the point’s node and each hold one sequence of the counter’s values. The last is the point’s own instance; each one encloses the next. Empty for a point that counts in the counter’s single sequence through the document, as nearly every point does.

Each instance must be a node that contains the point’s node (never the node that carries the point itself) and must enclose the next instance; otherwise the point is not numbered and the numbering stage reports the Error flm.numbering.instance-not-enclosing. An instance is given by its node’s identifier, as in ContentRef::Node, because an aspect is given a node of one tree and not the tree’s place in the document; the numbering stage records the instance as the full NodeAddr of that node.

§style: Name

The name of the counter style the point’s number is shown in, which gives the number format, the word before the number and the delimiters.

§advance: Vec<u32>

Which levels of the counter this point advances, in the order it advances them.

A counter value is a number with optional sub-numbers: level 0 is the number, level 1 the first sub-number, and advancing a level resets the deeper levels to zero. Most points advance [0] and show (3), then (4). A group of sub-numbered lines is written by advancing two levels at once on the first line and the deeper level alone on the rest: the first line advances [0, 1] and shows (3a), the lines after it advance [1] and show (3b), (3c), and the next equation advances [0] and shows (4).

§number_format: Option<String>

A number template of the point’s own, or None to use the number format of the counter style (style) as declared.

The text is a number template (NumberTemplate): every #{name} is the number in the format name (#{arabic}, #{alph}, #{roman}, …), every other character is written as given, and markup may surround the number: (#{alph}), #{Roman}.. The text is the author’s input, like the text of a \tag; for example, a list’s reference template written ref=(#{alph}), or label=(#{alph}) alone. The aspect passes it on as written, without compiling it, since an aspect has no language to compile it with. The numbering stage compiles each distinct text once per run and per counter style, and records the point in the counter style style with its number format replaced by this template, so that the point’s number and every reference to it use the template: (b), Item~(b). A template that does not compile is reported as the Error flm.numbering.bad-number-format, and the point is numbered with the counter style as declared.

Trait Implementations§

Source§

impl Clone for NumberSource

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 NumberSource

Source§

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

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

impl Eq for NumberSource

Source§

impl Hash for NumberSource

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for NumberSource

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NumberSource

Auto Trait Implementations§

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.