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 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 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 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)>
pad{top,bottom,left,right} to the computed dimensions. This is the SAFE
part of computeSizeStore — additive and inert until the app layer sets a
pad* property (display math \abovedisplayskip/\belowdisplayskip,
\overline/\underline 2pt, items/equations). The riskier requested-vs-
computed merge + full-spec bypass + isEmpty are deliberately NOT included
here — a mechanical port of those regressed (Rust boxes don’t use
width/height/depth uniformly as “requested box size”); see SYNC_STATUS U2.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().