pub struct VM<S> {
pub state: S,
pub commands_map: Map<S>,
pub working_directory: Option<PathBuf>,
/* private fields */
}
Expand description
The Texlang virtual machine.
Fields§
§state: S
The state
commands_map: Map<S>
The commands map
working_directory: Option<PathBuf>
The working directory which is used as the root for relative file paths
This is None if the working directory could not be determined.
Implementations§
source§impl<S: TexlangState> VM<S>
impl<S: TexlangState> VM<S>
source§impl<S: Default> VM<S>
impl<S: Default> VM<S>
sourcepub fn new_with_built_in_commands(
built_in_commands: HashMap<&str, BuiltIn<S>>
) -> VM<S>
pub fn new_with_built_in_commands( built_in_commands: HashMap<&str, BuiltIn<S>> ) -> VM<S>
Create a new VM with the provided built-in commands.
If the state type satisfies the HasDefaultBuiltInCommands
trait,
and you are using the default built-ins,
use the VM::new
method instead.
source§impl<S: Default + HasDefaultBuiltInCommands> VM<S>
impl<S: Default + HasDefaultBuiltInCommands> VM<S>
source§impl<'de, S: Deserialize<'de>> VM<S>
impl<'de, S: Deserialize<'de>> VM<S>
Deserialize a Texlang VM using the provided built-in commands.
If the state type satisfies the HasDefaultBuiltInCommands
trait,
and you are deserializing using the default built-ins,
you don’t need to use this function.
You can use the serde deserialize trait directly.
See the serde
submodule for more information on deserialization.
pub fn deserialize_with_built_in_commands<D: Deserializer<'de>>( deserializer: D, built_in_commands: HashMap<&str, BuiltIn<S>> ) -> Result<Self, D::Error>
source§impl<S: TexlangState> VM<S>
impl<S: TexlangState> VM<S>
source§impl<S> VM<S>
impl<S> VM<S>
sourcepub fn clear_sources(&mut self)
pub fn clear_sources(&mut self)
Clear all source code from the VM.
sourcepub fn get_commands_as_map_slow(&self) -> HashMap<String, BuiltIn<S>>
pub fn get_commands_as_map_slow(&self) -> HashMap<String, BuiltIn<S>>
Return a regular hash map with all the commands as they are currently defined.
This function is extremely slow and is only intended to be invoked on error paths.
sourcepub fn cs_name_interner(&self) -> &CsNameInterner
pub fn cs_name_interner(&self) -> &CsNameInterner
Return a reference to the control sequence name string interner.
This interner can be used to resolve CsName types into regular strings.
pub fn trace(&self, token: Token) -> SourceCodeTrace
pub fn trace_end_of_input(&self) -> SourceCodeTrace
sourcepub fn num_current_sources(&self) -> usize
pub fn num_current_sources(&self) -> usize
Returns the number of current sources on the source stack