Skip to main content

RegisterValue

Enum RegisterValue 

Source
pub enum RegisterValue {
    Number(Number),
    Dimension(Dimension),
    MuDimension(MuDimension),
    Glue(Glue),
    MuGlue(MuGlue),
    Token(Token),
    Tokens(Tokens),
    Pair(Pair),
}
Expand description

The values that can be read by, and stored in, a Register

Variants§

§

Number(Number)

A unitless number

§

Dimension(Dimension)

A dimension with associated unit

§

MuDimension(MuDimension)

A “mu” dimension with associated unit

§

Glue(Glue)

A Glue space

§

MuGlue(MuGlue)

A Mu Glue space

§

Token(Token)

used by token registers

§

Tokens(Tokens)

used by token registers

§

Pair(Pair)

A coordinate pair (x,y) — used by picture environment

Implementations§

Source§

impl RegisterValue

Source

pub fn coerce_to(self, rtype: RegisterType) -> RegisterValue

Coerce a numeric value to the requested register type, preserving the raw scaled value. eTeX \dimexpr/\numexpr/\glueexpr/\muexpr fix the result type by the command, not by the operands — but our expression evaluator’s “missing number, treated as zero” recovery and LHS-typed arithmetic can return e.g. Number(0) for a \dimexpr (Dimension) request, which then panics the register getter’s expect_dimension() (witness: \dimexpr inside a pgf-calc coordinate — arXiv 2302.02182 and ~8 siblings in the large-scale canvas crashed here). Coercing the final value to rtype keeps the getter total. Non-numeric values (Token/Tokens/ Pair) and already-matching types pass through unchanged.

Trait Implementations§

Source§

impl Clone for RegisterValue

Source§

fn clone(&self) -> RegisterValue

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 RegisterValue

Source§

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

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

impl Default for RegisterValue

Source§

fn default() -> Self

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

impl Display for RegisterValue

Source§

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

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

impl From<&RegisterValue> for RegisterType

Source§

fn from(v: &RegisterValue) -> RegisterType

Converts to this type from the input type.
Source§

impl From<&RegisterValue> for Number

Source§

fn from(v: &RegisterValue) -> Number

Converts to this type from the input type.
Source§

impl From<&RegisterValue> for Dimension

Source§

fn from(v: &RegisterValue) -> Dimension

Converts to this type from the input type.
Source§

impl From<&RegisterValue> for Glue

Source§

fn from(v: &RegisterValue) -> Glue

Converts to this type from the input type.
Source§

impl From<&RegisterValue> for MuGlue

Source§

fn from(v: &RegisterValue) -> MuGlue

Converts to this type from the input type.
Source§

impl From<Dimension> for RegisterValue

Source§

fn from(n: Dimension) -> RegisterValue

Converts to this type from the input type.
Source§

impl From<Glue> for RegisterValue

Source§

fn from(n: Glue) -> RegisterValue

Converts to this type from the input type.
Source§

impl From<MuDimension> for RegisterValue

Source§

fn from(n: MuDimension) -> RegisterValue

Converts to this type from the input type.
Source§

impl From<MuGlue> for RegisterValue

Source§

fn from(n: MuGlue) -> RegisterValue

Converts to this type from the input type.
Source§

impl From<Number> for RegisterValue

Source§

fn from(n: Number) -> RegisterValue

Converts to this type from the input type.
Source§

impl From<Pair> for RegisterValue

Source§

fn from(p: Pair) -> RegisterValue

Converts to this type from the input type.
Source§

impl From<RegisterValue> for Stored

Source§

fn from(rv: RegisterValue) -> Self

Converts to this type from the input type.
Source§

impl From<RegisterValue> for ArgWrap

Source§

fn from(t: RegisterValue) -> Self

Converts to this type from the input type.
Source§

impl From<RegisterValue> for Number

Source§

fn from(v: RegisterValue) -> Number

Converts to this type from the input type.
Source§

impl From<RegisterValue> for Dimension

Source§

fn from(v: RegisterValue) -> Dimension

Converts to this type from the input type.
Source§

impl From<RegisterValue> for Glue

Source§

fn from(v: RegisterValue) -> Glue

Converts to this type from the input type.
Source§

impl From<RegisterValue> for MuGlue

Source§

fn from(v: RegisterValue) -> MuGlue

Converts to this type from the input type.
Source§

impl From<RegisterValue> for f64

Source§

fn from(v: RegisterValue) -> f64

Converts to this type from the input type.
Source§

impl From<RegisterValue> for i64

Source§

fn from(v: RegisterValue) -> i64

Converts to this type from the input type.
Source§

impl From<RegisterValue> for Tokens

Source§

fn from(v: RegisterValue) -> Tokens

Converts to this type from the input type.
Source§

impl From<RegisterValue> for Digested

Source§

fn from(value: RegisterValue) -> Digested

Converts to this type from the input type.
Source§

impl From<Token> for RegisterValue

Source§

fn from(n: Token) -> RegisterValue

Converts to this type from the input type.
Source§

impl From<Tokens> for RegisterValue

Source§

fn from(n: Tokens) -> RegisterValue

Converts to this type from the input type.
Source§

impl IntoDigestedOptionResult<Result<Option<Digested>, Error>> for RegisterValue

Source§

impl NumericOps for RegisterValue

Source§

fn into_glue_type(self) -> Glue

For now only meant as a type cast, unimplemented in other cases DO NOT use this method to cast into a Glue object, define a .to_glue() instead

Source§

fn new(number: i64) -> Self

Source§

fn new_f64(number: f64) -> Self

Source§

fn value_of(self) -> i64

Source§

fn register_type(&self) -> RegisterType

Source§

fn add<T: NumericOps>(self, other: T) -> Self

Source§

fn subtract<T: NumericOps>(self, other: T) -> Self

Source§

fn multiply<T: NumericOps>(self, other: T) -> Self

Source§

fn negate(self) -> Self

Source§

fn divide<T: NumericOps>(self, other: T) -> Self
where Self: Sized,

Truncating division
Source§

fn smaller<T: NumericOps>(self, other: T) -> Self
where Self: Sized,

Source§

fn larger<T: NumericOps>(self, other: T) -> Self
where Self: Sized,

Source§

fn to_attribute(&self) -> String
where Self: Display,

Source§

fn unit(&self) -> Option<&'static str>

Source§

fn value_f64(self) -> f64
where Self: Sized,

Source§

fn pt_value(self, prec: Option<u8>) -> f64
where Self: Sized,

Source§

fn px_value(self, prec: Option<u8>) -> f64
where Self: Sized,

Source§

fn absolute(self) -> Self
where Self: Sized,

Source§

fn sign(self) -> i8
where Self: Sized,

Source§

fn divideround<T: NumericOps>(self, other: T) -> Self
where Self: Sized,

Rounding division
Source§

fn to_token(self) -> Token
where Self: Sized,

Source§

impl Object for RegisterValue

Source§

fn stringify(&self) -> String

Source§

fn revert(&self) -> Result<Tokens>

each concrete object needs to provide its own path back to tokens
Source§

fn isa_box(&self) -> bool

Source§

fn is_expandable(&self) -> bool

Source§

fn is_definition(&self) -> bool

Source§

fn is_comment(&self) -> bool

Source§

fn be_digested(self) -> Result<Digested>
where Self: Sized + Debug,

Source§

fn get_locator(&self) -> Option<Locator>

The object’s stored source locator, if it has one. None is the honest “no recorded source position” (replacing the old Locator::default() file!()/line!() sentinel). For “where the parser is now” (error reporting, box creation), use the free fn gullet::get_locator().
Source§

impl PartialEq for RegisterValue

Source§

fn eq(&self, other: &RegisterValue) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RegisterValue

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> IntoResultArgWrap<Result<ArgWrap, Error>> for T
where T: Into<ArgWrap>,

Source§

fn into_result_argwrap(self) -> Result<ArgWrap, Error>

performs the conversion
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.