Skip to main content

Math

Enum Math 

Source
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§

Source§

impl Clone for Math

Source§

fn clone(&self) -> Math

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 Math

Source§

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

Formats the value using the given formatter. Read more

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> 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<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> Clone for T
where T: Clone,

Source§

fn clone(&self) -> T

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> Debug for T
where T: Debug,

Source§

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

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<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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V