Skip to main content

MathElement

Enum MathElement 

Source
pub enum MathElement {
Show 20 variants Run(MathRun), Fraction(Fraction), Radical(Radical), Nary(Nary), Subscript(Script), Superscript(Script), SubSuperscript(SubSuperscript), PreScript(PreScript), Delimiter(Delimiter), Matrix(Matrix), Function(Function), Accent(Accent), Bar(Bar), Box(MathBox), BorderBox(BorderBox), EquationArray(EquationArray), LowerLimit(Limit), UpperLimit(Limit), GroupChar(GroupChar), Phantom(Phantom),
}
Expand description

A math element - one of the possible OMML constructs.

Variants§

§

Run(MathRun)

Text run (m:r).

§

Fraction(Fraction)

Fraction (m:f).

§

Radical(Radical)

Radical/root (m:rad).

§

Nary(Nary)

N-ary operator like sum or integral (m:nary).

§

Subscript(Script)

Subscript (m:sSub).

§

Superscript(Script)

Superscript (m:sSup).

§

SubSuperscript(SubSuperscript)

Subscript and superscript (m:sSubSup).

§

PreScript(PreScript)

Pre-subscript/superscript (m:sPre).

§

Delimiter(Delimiter)

Delimiter/parentheses (m:d).

§

Matrix(Matrix)

Matrix (m:m).

§

Function(Function)

Function like sin, cos (m:func).

§

Accent(Accent)

Accent like hat, tilde (m:acc).

§

Bar(Bar)

Bar over/under (m:bar).

§

Box(MathBox)

Box (m:box).

§

BorderBox(BorderBox)

Border box (m:borderBox).

§

EquationArray(EquationArray)

Equation array (m:eqArr).

§

LowerLimit(Limit)

Lower limit (m:limLow).

§

UpperLimit(Limit)

Upper limit (m:limUpp).

§

GroupChar(GroupChar)

Group character/brace (m:groupChr).

§

Phantom(Phantom)

Phantom (m:phant).

Implementations§

Source§

impl MathElement

Source

pub fn text(&self) -> String

Get text representation.

Trait Implementations§

Source§

impl Clone for MathElement

Source§

fn clone(&self) -> MathElement

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MathElement

Source§

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

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

impl MathElementExt for MathElement

Source§

fn is_fraction(&self) -> bool

Check if this is a fraction element.
Source§

fn is_radical(&self) -> bool

Check if this is a radical (root) element.
Source§

fn is_nary(&self) -> bool

Check if this is an n-ary operator (sum, integral, product, etc.).
Source§

fn is_script(&self) -> bool

Check if this is any kind of script (sub, sup, sub+sup, or pre-script).
Source§

fn is_matrix(&self) -> bool

Check if this is a matrix.
Source§

fn is_delimiter(&self) -> bool

Check if this is a delimiter (parentheses, brackets, etc.).
Source§

fn is_run(&self) -> bool

Check if this is a text run.
Source§

fn as_fraction(&self) -> Option<&Fraction>

Try to downcast to a Fraction.
Source§

fn as_radical(&self) -> Option<&Radical>

Try to downcast to a Radical.
Source§

fn as_nary(&self) -> Option<&Nary>

Try to downcast to an Nary.
Source§

fn as_matrix(&self) -> Option<&Matrix>

Try to downcast to a Matrix.
Source§

fn operator_count(&self) -> usize

Count the number of operator elements (Nary, Fraction, Radical) in this element recursively.

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.