pub struct Program<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16 = LIBS_MAX_TOTAL> where
    Isa: InstructionSet
{ /* private fields */ }
Expand description

An AluVM program executable by a virtual machine.

Generics

RUNTIME_MAX_TOTAL_LIBS: Maximum total number of libraries supported by a runtime, if it is less than LIBS_MAX_TOTAL. If the value set is greater than LIBS_MAX_TOTAL the value is ignored and LIBS_MAX_TOTAL constant is used instead.

Implementations

Constructs new virtual machine runtime using provided single library. Entry point is set to zero offset by default.

Constructs new virtual machine runtime from a set of libraries with a given entry point.

Returns reference to a specific library, if it is part of the current program.

Adds Alu bytecode library to the virtual machine runtime.

Errors

Checks requirement that the total number of libraries must not exceed LIBS_MAX_TOTAL and RUNTIME_MAX_TOTAL_LIBS - or returns LibError::TooManyLibs otherwise.

Checks that the ISA used by the VM supports ISA extensions specified by the library and returns LibError::IsaNotSupported otherwise.

Returns

true if the library was already known and false otherwise.

Returns number of libraries used by the program.

Returns program entry point.

Sets new entry point value (used when calling crate::Vm::run)

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.