Struct alure::Lib[][src]

pub struct Lib<E = NOp> where
    E: InstructionSet
{ /* fields omitted */ }
Expand description

AluVM executable code library

Implementations

impl<E> Lib<E> where
    E: InstructionSet
[src]

pub fn with<I>(code: I) -> Result<Lib<E>, EncodeError> where
    I: IntoIterator,
    <I as IntoIterator>::Item: InstructionSet
[src]

Constructs library for the provided instructions by encoding them into bytecode

pub fn lib_hash(&self) -> LibHash[src]

Returns hash identifier LibHash, representing the library in a unique way.

Lib hash is computed as SHA256 tagged hash of the serialized library bytecode.

pub fn byte_count(&self) -> u16[src]

Calculates length of bytecode encoding in bytes

pub fn bytecode(&self) -> &[u8]

Notable traits for &'_ mut [u8]

impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
[src]

Returns bytecode reference

pub fn run(&self, entrypoint: u16, registers: &mut Registers) -> Option<LibSite>[src]

Executes library code starting at entrypoint

Trait Implementations

impl<E> AsRef<[u8]> for Lib<E> where
    E: InstructionSet
[src]

fn as_ref(&self) -> &[u8]

Notable traits for &'_ mut [u8]

impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
[src]

Performs the conversion.

impl<E: Debug> Debug for Lib<E> where
    E: InstructionSet
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<E> Display for Lib<E> where
    E: InstructionSet
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<E> RefUnwindSafe for Lib<E> where
    E: RefUnwindSafe

impl<E> Send for Lib<E> where
    E: Send

impl<E> Sync for Lib<E> where
    E: Sync

impl<E> Unpin for Lib<E> where
    E: Unpin

impl<E> UnwindSafe for Lib<E> where
    E: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.