pub struct Prog<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16 = 1024>where
Isa: InstructionSet,{ /* private fields */ }
Expand description
The most trivial form of a program which is just a collection of libraries with some entry point.
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§
source§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet,
sourcepub fn new(lib: Lib) -> Self
pub fn new(lib: Lib) -> Self
Constructs new virtual machine runtime using provided single library. Entry point is set to zero offset by default.
sourcepub fn with(
libs: impl IntoIterator<Item = Lib>,
entrypoint: LibSite
) -> Result<Self, ProgError>
pub fn with( libs: impl IntoIterator<Item = Lib>, entrypoint: LibSite ) -> Result<Self, ProgError>
Constructs new virtual machine runtime from a set of libraries with a given entry point.
sourcepub fn add_lib(&mut self, lib: Lib) -> Result<bool, ProgError>
pub fn add_lib(&mut self, lib: Lib) -> Result<bool, ProgError>
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 ProgError::TooManyLibs
otherwise.
Checks that the ISA used by the VM supports ISA extensions specified by the library and
returns ProgError::IsaNotSupported
otherwise.
Returns
true
if the library was already known and false
otherwise.
sourcepub fn set_entrypoint(&mut self, entrypoint: LibSite)
pub fn set_entrypoint(&mut self, entrypoint: LibSite)
Sets new entry point value (used when calling crate::Vm::run
)
Trait Implementations§
source§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Clone for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet + Clone,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Clone for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet + Clone,
source§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Debug for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet + Debug,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Debug for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet + Debug,
source§impl<'de, Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Deserialize<'de> for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet,
impl<'de, Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Deserialize<'de> for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Hash for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet + Hash,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Hash for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet + Hash,
source§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Ord for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet + Ord,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Ord for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet + Ord,
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> PartialEq for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet + PartialEq,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> PartialEq for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet + PartialEq,
source§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> PartialOrd for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet + PartialOrd,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> PartialOrd for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet + PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Program for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Program for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet,
source§impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Serialize for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where
Isa: InstructionSet,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Serialize for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Eq for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet + Eq,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> StructuralEq for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> StructuralPartialEq for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: InstructionSet,
Auto Trait Implementations§
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> RefUnwindSafe for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: RefUnwindSafe,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Send for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: Send,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Sync for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: Sync,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> Unpin for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: Unpin,
impl<Isa, const RUNTIME_MAX_TOTAL_LIBS: u16> UnwindSafe for Prog<Isa, RUNTIME_MAX_TOTAL_LIBS>where Isa: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.