Expand description
AluVM executable code library
Fields
isae: IsaSeg
ISA segment
code: ByteStr
Code segment
data: ByteStr
Data segment
libs: LibSeg
Libs segment
Implementations
sourceimpl Lib
impl Lib
sourcepub fn with(
isa: &str,
bytecode: Vec<u8>,
data: Vec<u8>,
libs: LibSeg
) -> Result<Lib, SegmentError>
pub fn with(
isa: &str,
bytecode: Vec<u8>,
data: Vec<u8>,
libs: LibSeg
) -> Result<Lib, SegmentError>
Constructs library from raw data split into segments
sourcepub fn assemble<Isa>(code: &[Isa]) -> Result<Lib, AssemblerError> where
Isa: InstructionSet,
pub fn assemble<Isa>(code: &[Isa]) -> Result<Lib, AssemblerError> where
Isa: InstructionSet,
Assembles library from the provided instructions by encoding them into bytecode
sourcepub fn disassemble<Isa>(&self) -> Result<Vec<Isa>, CodeEofError> where
Isa: InstructionSet,
pub fn disassemble<Isa>(&self) -> Result<Vec<Isa>, CodeEofError> where
Isa: InstructionSet,
Disassembles library into a set of instructions
sourcepub fn id(&self) -> LibId
pub fn id(&self) -> LibId
Returns hash identifier LibId
, representing the library in a unique way.
Lib ID is computed as SHA256 tagged hash of the serialized library segments (ISAE, code, data).
sourcepub fn isae_segment(&self) -> String
pub fn isae_segment(&self) -> String
Returns ISA data
sourcepub fn code_segment(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
pub fn code_segment(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Returns reference to code segment
sourcepub fn data_segment(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
pub fn data_segment(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Returns reference to data segment
sourcepub fn libs_segment(&self) -> &LibSeg
pub fn libs_segment(&self) -> &LibSeg
Returns reference to libraries segment
Trait Implementations
sourceimpl Ord for Lib
impl Ord for Lib
sourceimpl PartialOrd<Lib> for Lib
impl PartialOrd<Lib> for Lib
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Lib
Auto Trait Implementations
impl RefUnwindSafe for Lib
impl Send for Lib
impl Sync for Lib
impl Unpin for Lib
impl UnwindSafe for Lib
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more