pub enum Stored {
Show 44 variants
None,
Bool(bool),
String(SymStr),
Charcode(u16),
Int(i64),
Node(Node),
Chars(Box<[char]>),
Fontmap(Rc<[Option<char>]>),
Strings(Rc<[SymStr]>),
VecDigested(Vec<Digested>),
Stash(StashTable),
HashString(FxHashMap<String, String>),
VecDequeStored(VecDeque<Stored>),
HashStored(SymHashMap<Stored>),
HashTagData(FxHashMap<String, Vec<TagData>>),
FrontmatterRaw(Vec<RawFrontmatter>),
Catcode(Catcode),
Token(Token),
Tokens(Tokens),
Number(Number),
Float(Float),
Glue(Glue),
MuGlue(MuGlue),
Dimension(Dimension),
MuDimension(MuDimension),
Locator(Box<Locator>),
Rewrite(Box<Rewrite>),
Ligature(Box<Ligature>),
Reversion(Reversion),
Register(Rc<Register>),
Expandable(Rc<Expandable>),
Conditional(Rc<Conditional>),
Primitive(Rc<Primitive>),
MathPrimitive(Rc<MathPrimitive>),
Constructor(Rc<Constructor>),
Digested(Digested),
Parameter(Rc<Parameter>),
Font(Rc<Font>),
FontDirective(FontDirective),
Mouth(Rc<RefCell<Mouth>>),
IfFrame(Rc<RefCell<IfFrame>>),
KeyVal(KeyVal),
KeyVals(Rc<KeyVals>),
Template(Rc<Template>),
}Expand description
The original global state (in Perl) allowed arbitrary values. To stay consistent, we create an extremely permissive struct that affords all essential kinds of values that appear essential.
Variants§
None
if we want to keep a key but make it ‘undef’, set it to None
Bool(bool)
atomic data (Copy)
String(SymStr)
atomic data (Clone)
Charcode(u16)
atomic data (Copy)
Int(i64)
atomic data (Copy) note that we currently work with 64-bit integers
Node(Node)
atomic data (Clone)
Chars(Box<[char]>)
boxed char
Fontmap(Rc<[Option<char>]>)
boxed [Option<char>]
Strings(Rc<[SymStr]>)
boxed collection
VecDigested(Vec<Digested>)
boxed collection (latexml)
Stash(StashTable)
the heart of state - a stored Stash table
HashString(FxHashMap<String, String>)
boxed map
VecDequeStored(VecDeque<Stored>)
boxed collection - Stored
HashStored(SymHashMap<Stored>)
boxed map - Stored
HashTagData(FxHashMap<String, Vec<TagData>>)
boxed map (latexml)
FrontmatterRaw(Vec<RawFrontmatter>)
queued-but-undigested frontmatter commands (Perl: frontmatter_raw)
Catcode(Catcode)
latexml object
Token(Token)
latexml object
Tokens(Tokens)
latexml object
Number(Number)
latexml object
Float(Float)
latexml object
Glue(Glue)
latexml object
MuGlue(MuGlue)
latexml object
Dimension(Dimension)
latexml object
MuDimension(MuDimension)
latexml object
Locator(Box<Locator>)
metadata object
Rewrite(Box<Rewrite>)
latexml object
Ligature(Box<Ligature>)
latexml object
Reversion(Reversion)
latexml object
Register(Rc<Register>)
latexml object (Rc-wrapped)
Expandable(Rc<Expandable>)
latexml object (Rc-wrapped)
Conditional(Rc<Conditional>)
latexml object (Rc-wrapped)
Primitive(Rc<Primitive>)
latexml object (Rc-wrapped)
MathPrimitive(Rc<MathPrimitive>)
latexml object (Rc-wrapped)
Constructor(Rc<Constructor>)
latexml object (Rc-wrapped)
Digested(Digested)
latexml object (Rc-wrapped from within)
Parameter(Rc<Parameter>)
latexml object (Rc-wrapped)
Font(Rc<Font>)
latexml object (Rc-wrapped)
FontDirective(FontDirective)
a stored FontDirective (Font or closure building a Font)
Mouth(Rc<RefCell<Mouth>>)
WALL OF SHAME (interior mutability) – can we dispense with these?
IfFrame(Rc<RefCell<IfFrame>>)
WALL OF SHAME (interior mutability) – can we dispense with these?
KeyVal(KeyVal)
latexml keyval definition
KeyVals(Rc<KeyVals>)
latexml keyvals collection
Template(Rc<Template>)
alignment template (for storing between macros, e.g. deluxetable)
Implementations§
Source§impl Stored
impl Stored
Sourcepub fn eq_text(&self, target: &str) -> bool
pub fn eq_text(&self, target: &str) -> bool
Zero-alloc equivalent of self.to_string() == target for the two
string-carrying variants (String, Tokens). Falls back to
to_string() for everything else, where the Display impl allocates
anyway.
Sourcepub fn is_list(&self) -> bool
pub fn is_list(&self) -> bool
A list-shaped value: exposed to the Rhai LookupValue binding as an array
(mirroring Perl’s LookupValue returning an arrayref), and having no
scalar string form — so lookup_string returns “” for it rather than
leaking the internal Debug repr (#315). The two variants a push_value /
list AssignValue can produce: VecDequeStored (a pushed queue, e.g.
class_options) and Strings (an immutable string array).
Sourcepub fn list_items(&self) -> Option<Vec<String>>
pub fn list_items(&self) -> Option<Vec<String>>
The items of a list value as strings, for structural access. None for a
non-list value.
Sourcepub fn starts_with_text(&self, prefix: &str) -> bool
pub fn starts_with_text(&self, prefix: &str) -> bool
Zero-alloc self.to_string().starts_with(prefix) for the
string-carrying variants; falls back to to_string() for others.
Sourcepub fn ends_with_text(&self, suffix: &str) -> bool
pub fn ends_with_text(&self, suffix: &str) -> bool
Zero-alloc self.to_string().ends_with(suffix) for the String /
Token variants (where the entire Display output equals the
interned text). For Tokens, we still walk into a small owned
String — ends_with requires anchoring at the tail and rolling
backward, which needs random access. Others fall back to
to_string() (cost paid anyway via the Display impl).
Sourcepub fn cast_to_string_hash(
in_map: &SymHashMap<Stored>,
) -> HashMap<String, String>
pub fn cast_to_string_hash( in_map: &SymHashMap<Stored>, ) -> HashMap<String, String>
helper method that uses ToString::to_string to flatten a map with Stored values
Sourcepub fn read_arguments(&self) -> Result<Vec<ArgWrap>>
pub fn read_arguments(&self) -> Result<Vec<ArgWrap>>
Dynamic dispatch for Definition’s read_arguments,
to circumvent the limitations of using trait objects with Rc<Definition>
Sourcepub fn to_attribute(&self) -> String
pub fn to_attribute(&self) -> String
Uses NumericOps::to_attribute for Stored values supporting it, otherwise
ToString::to_string
pub fn to_definition(&self) -> Option<Rc<dyn Definition>>
Trait Implementations§
Source§impl From<Conditional> for Stored
impl From<Conditional> for Stored
Source§fn from(value: Conditional) -> Self
fn from(value: Conditional) -> Self
Source§impl From<Constructor> for Stored
impl From<Constructor> for Stored
Source§fn from(value: Constructor) -> Self
fn from(value: Constructor) -> Self
Source§impl From<Expandable> for Stored
Storing all definitions is expected - Expandable case
impl From<Expandable> for Stored
Storing all definitions is expected - Expandable case
Source§fn from(definition: Expandable) -> Self
fn from(definition: Expandable) -> Self
Source§impl From<MathPrimitive> for Stored
impl From<MathPrimitive> for Stored
Source§fn from(value: MathPrimitive) -> Self
fn from(value: MathPrimitive) -> Self
Source§impl From<MuDimension> for Stored
impl From<MuDimension> for Stored
Source§fn from(value: MuDimension) -> Self
fn from(value: MuDimension) -> Self
Source§impl From<Rc<Conditional>> for Stored
impl From<Rc<Conditional>> for Stored
Source§fn from(definition: Rc<Conditional>) -> Self
fn from(definition: Rc<Conditional>) -> Self
Source§impl From<Rc<Constructor>> for Stored
impl From<Rc<Constructor>> for Stored
Source§fn from(definition: Rc<Constructor>) -> Self
fn from(definition: Rc<Constructor>) -> Self
Source§impl From<Rc<Expandable>> for Stored
impl From<Rc<Expandable>> for Stored
Source§fn from(definition: Rc<Expandable>) -> Self
fn from(definition: Rc<Expandable>) -> Self
Source§impl From<Rc<MathPrimitive>> for Stored
impl From<Rc<MathPrimitive>> for Stored
Source§fn from(definition: Rc<MathPrimitive>) -> Self
fn from(definition: Rc<MathPrimitive>) -> Self
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<SymHashMap<Stored>> for Stored
impl From<SymHashMap<Stored>> for Stored
Source§fn from(value: SymHashMap<Stored>) -> Self
fn from(value: SymHashMap<Stored>) -> Self
Source§impl PartialEq for Stored
Note: PartialEq on Stored is structural. See WISDOM.md for RegisterType trap.
impl PartialEq for Stored
Note: PartialEq on Stored is structural. See WISDOM.md for RegisterType trap.