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
impl RegisterValue
Sourcepub fn coerce_to(self, rtype: RegisterType) -> RegisterValue
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
impl Clone for RegisterValue
Source§fn clone(&self) -> RegisterValue
fn clone(&self) -> RegisterValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegisterValue
impl Debug for RegisterValue
Source§impl Default for RegisterValue
impl Default for RegisterValue
Source§impl Display for RegisterValue
impl Display for RegisterValue
Source§impl From<&RegisterValue> for RegisterType
impl From<&RegisterValue> for RegisterType
Source§fn from(v: &RegisterValue) -> RegisterType
fn from(v: &RegisterValue) -> RegisterType
Source§impl From<&RegisterValue> for Number
impl From<&RegisterValue> for Number
Source§fn from(v: &RegisterValue) -> Number
fn from(v: &RegisterValue) -> Number
Source§impl From<&RegisterValue> for Dimension
impl From<&RegisterValue> for Dimension
Source§fn from(v: &RegisterValue) -> Dimension
fn from(v: &RegisterValue) -> Dimension
Source§impl From<&RegisterValue> for Glue
impl From<&RegisterValue> for Glue
Source§fn from(v: &RegisterValue) -> Glue
fn from(v: &RegisterValue) -> Glue
Source§impl From<&RegisterValue> for MuGlue
impl From<&RegisterValue> for MuGlue
Source§fn from(v: &RegisterValue) -> MuGlue
fn from(v: &RegisterValue) -> MuGlue
Source§impl From<Dimension> for RegisterValue
impl From<Dimension> for RegisterValue
Source§fn from(n: Dimension) -> RegisterValue
fn from(n: Dimension) -> RegisterValue
Source§impl From<Glue> for RegisterValue
impl From<Glue> for RegisterValue
Source§fn from(n: Glue) -> RegisterValue
fn from(n: Glue) -> RegisterValue
Source§impl From<MuDimension> for RegisterValue
impl From<MuDimension> for RegisterValue
Source§fn from(n: MuDimension) -> RegisterValue
fn from(n: MuDimension) -> RegisterValue
Source§impl From<MuGlue> for RegisterValue
impl From<MuGlue> for RegisterValue
Source§fn from(n: MuGlue) -> RegisterValue
fn from(n: MuGlue) -> RegisterValue
Source§impl From<Number> for RegisterValue
impl From<Number> for RegisterValue
Source§fn from(n: Number) -> RegisterValue
fn from(n: Number) -> RegisterValue
Source§impl From<Pair> for RegisterValue
impl From<Pair> for RegisterValue
Source§fn from(p: Pair) -> RegisterValue
fn from(p: Pair) -> RegisterValue
Source§impl From<RegisterValue> for Stored
impl From<RegisterValue> for Stored
Source§fn from(rv: RegisterValue) -> Self
fn from(rv: RegisterValue) -> Self
Source§impl From<RegisterValue> for ArgWrap
impl From<RegisterValue> for ArgWrap
Source§fn from(t: RegisterValue) -> Self
fn from(t: RegisterValue) -> Self
Source§impl From<RegisterValue> for Number
impl From<RegisterValue> for Number
Source§fn from(v: RegisterValue) -> Number
fn from(v: RegisterValue) -> Number
Source§impl From<RegisterValue> for Dimension
impl From<RegisterValue> for Dimension
Source§fn from(v: RegisterValue) -> Dimension
fn from(v: RegisterValue) -> Dimension
Source§impl From<RegisterValue> for Glue
impl From<RegisterValue> for Glue
Source§fn from(v: RegisterValue) -> Glue
fn from(v: RegisterValue) -> Glue
Source§impl From<RegisterValue> for MuGlue
impl From<RegisterValue> for MuGlue
Source§fn from(v: RegisterValue) -> MuGlue
fn from(v: RegisterValue) -> MuGlue
Source§impl From<RegisterValue> for f64
impl From<RegisterValue> for f64
Source§fn from(v: RegisterValue) -> f64
fn from(v: RegisterValue) -> f64
Source§impl From<RegisterValue> for i64
impl From<RegisterValue> for i64
Source§fn from(v: RegisterValue) -> i64
fn from(v: RegisterValue) -> i64
Source§impl From<RegisterValue> for Tokens
impl From<RegisterValue> for Tokens
Source§fn from(v: RegisterValue) -> Tokens
fn from(v: RegisterValue) -> Tokens
Source§impl From<RegisterValue> for Digested
impl From<RegisterValue> for Digested
Source§fn from(value: RegisterValue) -> Digested
fn from(value: RegisterValue) -> Digested
Source§impl From<Token> for RegisterValue
impl From<Token> for RegisterValue
Source§fn from(n: Token) -> RegisterValue
fn from(n: Token) -> RegisterValue
Source§impl From<Tokens> for RegisterValue
impl From<Tokens> for RegisterValue
Source§fn from(n: Tokens) -> RegisterValue
fn from(n: Tokens) -> RegisterValue
Source§impl IntoDigestedOptionResult<Result<Option<Digested>, Error>> for RegisterValue
impl IntoDigestedOptionResult<Result<Option<Digested>, Error>> for RegisterValue
Source§impl NumericOps for RegisterValue
impl NumericOps for RegisterValue
Source§fn into_glue_type(self) -> Glue
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
fn new(number: i64) -> Self
fn new_f64(number: f64) -> Self
fn value_of(self) -> i64
fn register_type(&self) -> RegisterType
fn add<T: NumericOps>(self, other: T) -> Self
fn subtract<T: NumericOps>(self, other: T) -> Self
fn multiply<T: NumericOps>(self, other: T) -> Self
fn negate(self) -> Self
Source§fn divide<T: NumericOps>(self, other: T) -> Selfwhere
Self: Sized,
fn divide<T: NumericOps>(self, other: T) -> Selfwhere
Self: Sized,
fn smaller<T: NumericOps>(self, other: T) -> Selfwhere
Self: Sized,
fn larger<T: NumericOps>(self, other: T) -> Selfwhere
Self: Sized,
fn to_attribute(&self) -> Stringwhere
Self: Display,
fn unit(&self) -> Option<&'static str>
fn value_f64(self) -> f64where
Self: Sized,
fn pt_value(self, prec: Option<u8>) -> f64where
Self: Sized,
fn px_value(self, prec: Option<u8>) -> f64where
Self: Sized,
fn absolute(self) -> Selfwhere
Self: Sized,
fn sign(self) -> i8where
Self: Sized,
Source§fn divideround<T: NumericOps>(self, other: T) -> Selfwhere
Self: Sized,
fn divideround<T: NumericOps>(self, other: T) -> Selfwhere
Self: Sized,
fn to_token(self) -> Tokenwhere
Self: Sized,
Source§impl Object for RegisterValue
impl Object for RegisterValue
fn stringify(&self) -> String
Source§fn revert(&self) -> Result<Tokens>
fn revert(&self) -> Result<Tokens>
fn isa_box(&self) -> bool
fn is_expandable(&self) -> bool
fn is_definition(&self) -> bool
fn is_comment(&self) -> bool
fn be_digested(self) -> Result<Digested>
Source§fn get_locator(&self) -> Option<Locator>
fn get_locator(&self) -> Option<Locator>
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().