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§

source

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.

source

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.

source

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§

source

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.

Implementations on Foreign Types§

source§

impl SupportedType for i32

source§

fn new_command<S>( ref_fn: RefFn<S, Self>, ref_mut_fn: MutRefFn<S, Self>, index_resolver: Option<IndexResolver<S>> ) -> Command<S>

source§

fn update_save_stack<S>( input: &mut ExecutionInput<S>, variable: &TypedVariable<S, Self>, scope: Scope, overwritten_value: Self )

source§

fn new_typed_variable<S>( command: &Command<S>, index: Index ) -> Option<TypedVariable<S, Self>>

source§

impl SupportedType for Vec<Token>

source§

fn new_command<S>( ref_fn: RefFn<S, Self>, ref_mut_fn: MutRefFn<S, Self>, index_resolver: Option<IndexResolver<S>> ) -> Command<S>

source§

fn update_save_stack<S>( input: &mut ExecutionInput<S>, variable: &TypedVariable<S, Self>, scope: Scope, overwritten_value: Self )

source§

fn recycle<S>(input: &mut ExecutionInput<S>, overwritten_value: Self)

source§

fn new_typed_variable<S>( command: &Command<S>, index: Index ) -> Option<TypedVariable<S, Self>>

Implementors§