Trait texlang::variable::SupportedType
source · pub trait SupportedType: Sized {
// Required methods
fn new_command<S>(
ref_fn: RefFn<S, Self>,
ref_mut_fn: MutRefFn<S, Self>,
index_resolver: Option<IndexResolver<S>>
) -> Command<S>;
fn update_save_stack<S>(
input: &mut ExecutionInput<S>,
variable: &TypedVariable<S, Self>,
scope: Scope,
overwritten_value: Self
);
fn new_typed_variable<S>(
command: &Command<S>,
index: Index
) -> Option<TypedVariable<S, Self>>;
// Provided method
fn recycle<S>(input: &mut ExecutionInput<S>, overwritten_value: Self) { ... }
}
Expand description
Trait satisfied by all Rust types that can be used as TeX variables.
It exists to make the variables API more ergonomic. For example, it is used to provide a uniform constructor Command::new_array for commands. The trait cannot be implemented for new types.
Required Methods§
sourcefn new_command<S>(
ref_fn: RefFn<S, Self>,
ref_mut_fn: MutRefFn<S, Self>,
index_resolver: Option<IndexResolver<S>>
) -> Command<S>
fn new_command<S>( ref_fn: RefFn<S, Self>, ref_mut_fn: MutRefFn<S, Self>, index_resolver: Option<IndexResolver<S>> ) -> Command<S>
Create a new command of this type with the provided reference functions and index resolver.
sourcefn update_save_stack<S>(
input: &mut ExecutionInput<S>,
variable: &TypedVariable<S, Self>,
scope: Scope,
overwritten_value: Self
)
fn update_save_stack<S>( input: &mut ExecutionInput<S>, variable: &TypedVariable<S, Self>, scope: Scope, overwritten_value: Self )
Update the VM’s save stack after a variable assignment.
sourcefn new_typed_variable<S>(
command: &Command<S>,
index: Index
) -> Option<TypedVariable<S, Self>>
fn new_typed_variable<S>( command: &Command<S>, index: Index ) -> Option<TypedVariable<S, Self>>
Create a new typed variable of this type from the getters in the command and the provided index.
Return None
if the command has a different type to Self
.
Provided Methods§
sourcefn recycle<S>(input: &mut ExecutionInput<S>, overwritten_value: Self)
fn recycle<S>(input: &mut ExecutionInput<S>, overwritten_value: Self)
Recycle a value that’s about to be dropped.
This method is intended for token lists, in which case the vector is returned to the buffers pool.