pub struct SafeLabels {
pub by_label: BTreeMap<String, BTreeMap<String, String>>,
pub by_name: BTreeMap<String, BTreeMap<String, String>>,
pub allocated: u32,
}Expand description
The safe-labels table, flm.labels.safe (SAFE_LABELS): per domain,
from a label’s key (label_key) to the safe label allocated for it, and
back.
A safe label is the key the recomposed LaTeX writes for an FLM label
(ref1, ref2, … in the order the document first mentions the labels),
so that any label text an author wrote is carried through LaTeX’s
auxiliary file. The recomposed LaTeX writes it in each \label (inside
the LaTeX hook \flmLabels
when the backend’s render option
label_hooks
is on)
and in each reference.
A value name (ref-v1, ref-v2, …; value_name) is the key written
for a target that a reference inside a synthesized value mentions and that
has no safe label in the document; it is numbered apart from the
document’s safe labels so that the two sequences never collide. See the
module documentation.
Read the safe label of a key with safe_name,
and the key of a safe label with label_of. A key
the table does not hold is one the stage allocated nothing for (a label of
a type written raw), which a rule writes as written.
Fields§
§by_label: BTreeMap<String, BTreeMap<String, String>>Domain → the label’s key → the safe label allocated for it.
by_name: BTreeMap<String, BTreeMap<String, String>>Domain → the safe label → the label’s key, the reverse of
by_label.
allocated: u32How many safe labels have been allocated across every domain: the next one’s number is one more.
Implementations§
Source§impl SafeLabels
impl SafeLabels
Sourcepub fn safe_name(&self, domain: &str, key: &str) -> Option<&str>
pub fn safe_name(&self, domain: &str, key: &str) -> Option<&str>
The safe label allocated for the key key in domain, or None when
the stage allocated none for it. Build key with label_key.
Trait Implementations§
Source§impl Clone for SafeLabels
impl Clone for SafeLabels
Source§impl Debug for SafeLabels
impl Debug for SafeLabels
Source§impl Default for SafeLabels
impl Default for SafeLabels
Source§impl Table for SafeLabels
impl Table for SafeLabels
Source§fn absorb(&mut self, piece: SafeLabels)
fn absorb(&mut self, piece: SafeLabels)
The entries of a table piece are added to this table’s; a key that already has a safe label keeps it. The stage writes the whole table at once, so two table pieces never hold the labels of one document.
Source§fn project(&self, _cx: &dyn ProjectCx) -> SerialValue
fn project(&self, _cx: &dyn ProjectCx) -> SerialValue
Projects the table as {<domain>: {labels: {<key>: <safe label>}, names: {<safe label>: <key>}}}.
Source§fn piece_class(&self) -> PieceClass
fn piece_class(&self) -> PieceClass
Auto Trait Implementations§
impl Forget for SafeLabels
impl Freeze for SafeLabels
impl Move for SafeLabels
impl RefUnwindSafe for SafeLabels
impl Send for SafeLabels
impl Sync for SafeLabels
impl Unpin for SafeLabels
impl UnsafeUnpin for SafeLabelswhere
*const LeafNode<String, BTreeMap<String, String>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, BTreeMap<String, String>)>>: UnsafeUnpin,
impl UnwindSafe for SafeLabels
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<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