Skip to main content

SegmentMeta

Struct SegmentMeta 

Source
pub struct SegmentMeta {
    pub depth: usize,
    pub noindent: bool,
    pub font: Option<String>,
    pub namespaces: Vec<(String, String)>,
    pub section_id: Option<String>,
    pub parent: Option<String>,
    pub ancestors: Vec<String>,
}
Expand description

Per-segment facts recorded at spill time and consumed when the segment is re-materialized in pass 2.

Fields§

§depth: usize

Spine depth of the spilled subtree’s insertion point (the depth the serializer must resume at for indentation to match the eager output).

§noindent: bool

The spill parent’s noindent_children — the noindent value the eager serializer would have passed when recursing into these children (schema-driven: whether the parent can contain #PCDATA). Pass-2 re-serialization must use the same value or indentation diverges.

§font: Option<String>

The ancestor font context at the spill point, in Font::to_string form — the seed finalize_rec needs so per-fragment finalize resolves fonts exactly as the whole-document walk would have.

§namespaces: Vec<(String, String)>

Namespace declarations ((prefix, uri)) the wrapper must carry so the segment parses stand-alone. In the eager DOM these live on the document root (hoisted during build); a spilled subtree’s own serialization does not repeat them.

§section_id: Option<String>

The nearest ancestor SECTION’s xml:id on the spine at the spill point. Scope-gated processing (\lxDeclare section scoping) resolves a token’s section by walking ancestors — which a spilled-from-inside-a-section fragment no longer has.

§parent: Option<String>

The qname of the spilled run’s PARENT element (the spine node the segment splices back under). Pass-2 finalize consults the parent for schema decisions — e.g. collapsing an attribute-less ltx:text font wrapper requires can_contain(parent, grandchild) — and the parse wrapper (ltx:_lxfragment) is not in the model, so the recorded real parent substitutes for it (witness: tests/digestion/dollar.tex kept an empty <text> around an inline-block that eager collapsed).

§ancestors: Vec<String>

Every xml:id on the spilled run’s ANCESTOR chain at the spill point. A label:/id:-scoped rewrite whose scope node is one of these ancestors covers the WHOLE fragment (the fragment sits inside the scope subtree), but the node itself lives in another fragment — the selection would come up empty (witness: tests/math/simplemath.tex, where label:sec:restricted stamps role=FUNCTION inside a section whose shell spills separately from its paragraphs).

Trait Implementations§

Source§

impl Clone for SegmentMeta

Source§

fn clone(&self) -> SegmentMeta

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 SegmentMeta

Source§

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

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

impl Default for SegmentMeta

Source§

fn default() -> SegmentMeta

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

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> 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<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> 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> 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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.