Skip to main content

Gullet

Struct Gullet 

Source
pub struct Gullet {
    pub runtime: Option<MouthRuntime>,
    pub mouthstack: VecDeque<MouthRuntime>,
    pub pending_comments: VecDeque<Token>,
    pub token_limit: Option<usize>,
    pub pushback_limit: Option<usize>,
    pub progress: usize,
    pub cycle_guard_activate: usize,
    pub cycle_guard: CycleGuard,
    pub ctx_serial: u64,
    /* private fields */
}

Fields§

§runtime: Option<MouthRuntime>§mouthstack: VecDeque<MouthRuntime>§pending_comments: VecDeque<Token>§token_limit: Option<usize>§pushback_limit: Option<usize>§progress: usize§cycle_guard_activate: usize

Token-progress floor above which cycle_guard engages. Defaults to CYCLE_GUARD_ACTIVATE (20M). Graphics packages whose healthy expansion legitimately runs to 100M+ tokens (pgf/tikz/xy) raise it via raise_cycle_guard_activate so their streams stay out of the per-token fingerprint regime; the 400M token_limit remains the hard backstop. #[derive(Default)] would zero this (guard-always-on), so it is set explicitly in the constructor and the per-conversion reset.

§cycle_guard: CycleGuard

Windowed cycle detector over the expansion (read-token) stream — catches small-period infinite expansion loops (\def\x{a\x} etc.) far earlier and more cheaply than token_limit/pushback_limit. Gated on a high progress so normal documents never touch it. See crate::cycle_guard.

§ctx_serial: u64

Reading-context serial, mixed into every cycle-guard fingerprint so that windows never match ACROSS reading_from_mouth contexts: a cycle is only a cycle within one expansion context. Each reading_from_mouth entry allocates a fresh serial (from ctx_next) and restores the outer one on exit (ctx_stack), so (a) consecutive IDENTICAL short expansions — the math0402448 xymatrix per-cell get_xmarg_id stream — get distinct serials and can never concatenate into a pseudo-periodic window (the false positive an earlier blanket reset() suppressed), while (b) an OUTER loop’s tokens keep their serial across inner expansions, so a runaway whose body calls do_expand each iteration (~164 call sites) remains detectable — the blind spot the blanket reset had (PR #249 review P2-7).

Trait Implementations§

Source§

impl Debug for Gullet

Source§

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

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

impl Default for Gullet

Source§

fn default() -> Gullet

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> 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, 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.