pub struct KeyVals { /* private fields */ }Implementations§
Source§impl KeyVals
impl KeyVals
Sourcepub fn new(options: KeyvalsConfig) -> Self
pub fn new(options: KeyvalsConfig) -> Self
§====================================================================== The KeyVals constructor
This defines the KeyVals data object that can appear in the datastream along with tokens, boxes, etc. Thus it has to be digestible, however we may not want to digest it more than once.
Sourcepub fn stated_entry(&self, keys: &[&str]) -> Option<(&str, &Tokens)>
pub fn stated_entry(&self, keys: &[&str]) -> Option<(&str, &Tokens)>
The tokens the last of keys given states as its length value (width=0.48\textwidth), where they were kept
(parameter::KEEP_STATED_LENGTHS), with the key that stated them (width, totalheight; the value they gave is
Self::get_value’s): a key given again replaces its value.
Sourcepub fn get_value(&self, key: &str) -> Option<&ArgWrap>
pub fn get_value(&self, key: &str) -> Option<&ArgWrap>
return the value of a given key. If multiple values are given, return the last one.
Sourcepub fn get_value_digested(&self, key: &str) -> Option<&Digested>
pub fn get_value_digested(&self, key: &str) -> Option<&Digested>
return the digested value of a given key. If multiple values are given, return the last one. This call does not digest the value, and will return None if called pre-digestion
Sourcepub fn get_values(&self, key: &str) -> Option<&Vec<ArgWrap>>
pub fn get_values(&self, key: &str) -> Option<&Vec<ArgWrap>>
return a list of values for a given key
Sourcepub fn get_values_digested(&self, key: &str) -> Option<&Vec<Digested>>
pub fn get_values_digested(&self, key: &str) -> Option<&Vec<Digested>>
return the digested values of a given key, in the order given
Sourcepub fn as_flat_hash(self) -> HashMap<String, ArgWrap>
pub fn as_flat_hash(self) -> HashMap<String, ArgWrap>
consume KeyVals and return a flat HashMap
Sourcepub fn as_hash(self) -> HashMap<String, Vec<ArgWrap>>
pub fn as_hash(self) -> HashMap<String, Vec<ArgWrap>>
consume KeyVals and return the cached HashMap of input values
Sourcepub fn as_hash_digested(self) -> HashMap<String, Vec<Digested>>
pub fn as_hash_digested(self) -> HashMap<String, Vec<Digested>>
consume KeyVals and return the cached HashMap of digested values
Sourcepub fn get_hash_digested(&self) -> HashMap<String, String>
pub fn get_hash_digested(&self) -> HashMap<String, String>
returns a key => ToString(value)
pub fn get_keyvals(&self) -> &HashMap<String, Vec<ArgWrap>>
pub fn has_key(&self, key: &str) -> bool
pub fn set_keys_expansion(&self) -> Tokens
pub fn revert(&self) -> Result<Tokens>
pub fn add_value( &mut self, key: &str, value_arg: ArgWrap, use_default: bool, no_rebuild: bool, ) -> Result<()>
pub fn set_value( &mut self, key: &str, value: ArgWrap, use_default: bool, ) -> Result<()>
pub fn read_from(&mut self, until: Token, silence_missing: bool) -> Result<()>
Sourcepub fn into_tokens(self) -> Result<Tokens>
pub fn into_tokens(self) -> Result<Tokens>
TODO: This is an improvised method for switching KeyVals into Tokens, but losing all collected metadata. The long-term solution ought to be via a type system extension, where the arguments to our before-digest closures are a vector of a new type ReadValue ::= [Token, KeyVals, RegisterValue] potentially? On the other hand, we can also put the extra effort of postponing the build of KV metadata until digestion, this way not losing any time reserializing metadata
Trait Implementations§
Source§impl BoxOps for KeyVals
impl BoxOps for KeyVals
Source§fn with_properties<R, FnR>(&self, caller: FnR) -> R
fn with_properties<R, FnR>(&self, caller: FnR) -> R
Source§fn get_string(&self) -> Result<Cow<'_, str>>
fn get_string(&self) -> Result<Cow<'_, str>>
Source§fn set_property<T: Into<Stored>>(&mut self, _key: &str, _value: T)
fn set_property<T: Into<Stored>>(&mut self, _key: &str, _value: T)
Stored types for values)Source§fn be_absorbed(&self, _document: &mut Document) -> Result<Vec<Node>>
fn be_absorbed(&self, _document: &mut Document) -> Result<Vec<Node>>
Document XML - returning the corresponding nodesSource§fn compute_size(
&self,
_options: SymHashMap<Stored>,
) -> Result<(Dimension, Dimension, Dimension)>
fn compute_size( &self, _options: SymHashMap<Stored>, ) -> Result<(Dimension, Dimension, Dimension)>
Source§fn unlist(&self) -> Vec<Digested>
fn unlist(&self) -> Vec<Digested>
fn unlist_ref(&self) -> Vec<Cow<'_, Digested>>
Source§fn be_absorbed_mut(&mut self, _document: &mut Document) -> Result<Vec<Node>>
fn be_absorbed_mut(&mut self, _document: &mut Document) -> Result<Vec<Node>>
Alignment only)Source§fn get_tokens(&self) -> Option<&Tokens>
fn get_tokens(&self) -> Option<&Tokens>
Source§fn get_properties(&self) -> &HashMap<Stored>
fn get_properties(&self) -> &HashMap<Stored>
with_properties instead.Source§fn get_properties_mut(&mut self) -> &mut HashMap<Stored>
fn get_properties_mut(&mut self) -> &mut HashMap<Stored>
Source§fn set_memo_property<T: Into<Stored>>(&mut self, key: &str, value: T)
fn set_memo_property<T: Into<Stored>>(&mut self, key: &str, value: T)
BoxOps::set_property for a memo — a value the box can compute again — which a box busy elsewhere (being
absorbed) does without, where Perl’s plain hash store (Box.pm:294-296) always lands.Source§fn get_property(&self, key: &str) -> Option<Cow<'_, Stored>>
fn get_property(&self, key: &str) -> Option<Cow<'_, Stored>>
fn get_property_string(&self, key: &str) -> String
Source§fn get_property_mut(&mut self, key: &str) -> Option<&mut Stored>
fn get_property_mut(&mut self, key: &str) -> Option<&mut Stored>
Source§fn has_property(&self, key: &str) -> bool
fn has_property(&self, key: &str) -> bool
Source§fn get_property_bool(&self, key: &str) -> bool
fn get_property_bool(&self, key: &str) -> bool
Stored::Bool)Source§fn get_body(&self) -> Result<Option<Digested>>
fn get_body(&self) -> Result<Option<Digested>>
Source§fn get_width(
&self,
options: Option<HashMap<Stored>>,
) -> Result<Option<RegisterValue>>
fn get_width( &self, options: Option<HashMap<Stored>>, ) -> Result<Option<RegisterValue>>
Source§fn set_height<T: Into<Stored>>(&mut self, width: T)
fn set_height<T: Into<Stored>>(&mut self, width: T)
Source§fn get_height(&self) -> Option<RegisterValue>
fn get_height(&self) -> Option<RegisterValue>
Source§fn get_depth(&self) -> Option<RegisterValue>
fn get_depth(&self) -> Option<RegisterValue>
Source§fn get_size(
&mut self,
options: Option<HashMap<Stored>>,
) -> Result<(Dimension, Dimension, Dimension, Dimension, Dimension, Dimension)>
fn get_size( &mut self, options: Option<HashMap<Stored>>, ) -> Result<(Dimension, Dimension, Dimension, Dimension, Dimension, Dimension)>
Digested::get_size for a variant with interior mutability which caches the box sizeSource§fn compute_size_and_cache(
&mut self,
options: HashMap<Stored>,
) -> Result<(Dimension, Dimension, Dimension)>
fn compute_size_and_cache( &mut self, options: HashMap<Stored>, ) -> Result<(Dimension, Dimension, Dimension)>
computeSizeStore (Box.pm:266-297). A box whose size is completely
specified keeps that size, and its contents are not measured (:275-281):
width, height and depth all given, a space’s width, or a vertical space’s
height or depth. A pgf picture declares its size, and sizing a box that
holds one walked every drawing box of it (pgf-spectraPreviewDataLSE, 56kq).
Perl #2798 (S5, padding slice): the size then takes any requested
pad{top,bottom,left,right} (display math
\abovedisplayskip/\belowdisplayskip, \overline/\underline 2pt,
items/equations). Not ported: a partly specified size keeping its given
parts over the computed ones, and isEmpty — a mechanical port of those
regressed (Rust boxes don’t use width/height/depth uniformly as “requested
box size”; docs/archive/UPSTREAM_SYNC_2767_to_2833_2026-06-26.md, U2 and
slice S5); tracked with K18 in docs/SYNC_STATUS.md.Source§impl Object for KeyVals
impl Object for KeyVals
fn stringify(&self) -> String
fn be_digested(self) -> Result<Digested>
fn isa_box(&self) -> bool
fn is_expandable(&self) -> bool
fn is_definition(&self) -> bool
fn is_comment(&self) -> bool
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().Source§fn get_origin(&self) -> DefinitionOrigin
fn get_origin(&self) -> DefinitionOrigin
definition::origin). The
default is Unknown, which counts as LaTeXML’s own.