pub enum Math {
Show 14 variants
Pure(MathElement),
Group(MathKind, MathKind, Vec<Math>),
Sup(Vec<Math>, Vec<Math>),
Sub(Vec<Math>, Vec<Math>),
ChangeColor(Color, Vec<Math>),
ChangeCharClass(MathCharClass, Vec<Math>),
Fraction(Vec<Math>, Vec<Math>),
Radical(Option<Vec<Math>>, Vec<Math>),
Paren(Box<Value>, Box<Value>, Vec<Math>),
ParenWithMiddle(Box<Value>, Box<Value>, Box<Value>, Vec<Vec<Math>>),
UpperLimit(Vec<Math>, Vec<Math>),
LowerLimit(Vec<Math>, Vec<Math>),
PullInScripts(MathKind, MathKind, Box<Value>),
WithContext(Box<Context>, Vec<Math>),
}Expand description
One atom of a faithful math value (Value::Math‘s element type) —
trimmed mirror of upstream math (types.cppo.ml:1024). Every
closure-typed field upstream carries (kern functions, a paren pair’s
sizing closures, math-pull-in-scripts’ resolver, text-in-math’s
embedded-box callback) is stored here OPAQUELY as a plain Value —
constructing one of these variants never calls such a closure, exactly
like upstream, where a math value is inert data until the real layout
engine walks it.
Variants§
Pure(MathElement)
One base atom — a char run, a styled char, or embedded text. See
MathElement.
Group(MathKind, MathKind, Vec<Math>)
math-group: override the left/right math-class of a sub-math
(\mathbin, \mathrel, …) — the two classes can differ (unlike
every other variant here, which presents one class on both sides),
which is exactly why upstream gives it its own node rather than
folding it into ChangeContext.
Sup(Vec<Math>, Vec<Math>)
math-sup: base ^ script.
Sub(Vec<Math>, Vec<Math>)
math-sub: base _ script.
ChangeColor(Color, Vec<Math>)
math-color.
ChangeCharClass(MathCharClass, Vec<Math>)
math-char-class (\mathrm/\mathbf/…) — the resolved
MathCharClass a math-char-class primitive call named (\mathrm
-> MathRoman -> MathCharClass::Roman, …). Its layout arm
(primitives.rs) sets Context::math_char_class to this while
laying out the inner list, which is what makes VariantCharPending’s
per-char remap style-sensitive.
Fraction(Vec<Math>, Vec<Math>)
math-frac: numerator, denominator.
Radical(Option<Vec<Math>>, Vec<Math>)
math-radical: \sqrt[degree]{radicand} — None degree is the
common \sqrt case (math-radical None radicand); upstream’s own
MathRadicalWithDegree is failwith-unimplemented too
(math.ml:886), so a Some degree here is carried faithfully but
never rendered specially (matches upstream by parity).
Paren(Box<Value>, Box<Value>, Vec<Math>)
math-paren: left/right paren-sizing closures (each a paren = length -> length -> length -> length -> color -> inline-boxes * (length -> length), carried opaquely) plus the bracketed content.
ParenWithMiddle(Box<Value>, Box<Value>, Box<Value>, Vec<Vec<Math>>)
math-paren-with-middle: left/right/middle paren closures plus the
\setsep-style list of bracketed sub-maths.
UpperLimit(Vec<Math>, Vec<Math>)
math-upper: base with an over-script (\overline-adjacent, big-
operator upper limit).
LowerLimit(Vec<Math>, Vec<Math>)
math-lower: base with an under-script (big-operator lower limit).
PullInScripts(MathKind, MathKind, Box<Value>)
math-pull-in-scripts: a big operator’s own left/right class plus
the (math option -> math option -> math) resolver closure that
routes an eventual ^/_ into limits instead of corner scripts
(\sum^n_i-style). The closure is carried opaquely, same as
Paren’s; only actually invoked by the real layout engine.
WithContext(Box<Context>, Vec<Math>)
V0_1 only: read-math’s captured reading context — the port’s
coarse-grained stand-in for upstream’s
per-node context fields (types.cppo.ml:1051-1110). Constructed
ONLY by the V0_1 primitive read-math; no V0_0 path ever builds
or matches this variant. Its layout arm (primitives.rs’s
layout_math_list) lays inner out with ambient context = *ctx
and size = ctx.font_size as an ABSOLUTE override — a WithContext
produced under an enter_scripted context already carries the
script-shrunk size, so the engine’s own Sup/Sub shrink never
double-applies to it.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Math
impl !Send for Math
impl !Sync for Math
impl !UnwindSafe for Math
impl Freeze for Math
impl Unpin for Math
impl UnsafeUnpin for Math
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> 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