pub struct Lib {
pub isae: TinyOrdSet<IsaId>,
pub code: SmallBlob,
pub data: SmallBlob,
pub libs: LibsSeg,
}
Expand description
An AluVM library, which can be executed on a VM instance.
Fields§
§isae: TinyOrdSet<IsaId>
ISA extension segment.
code: SmallBlob
Code segment.
data: SmallBlob
Data segment.
libs: LibsSeg
Library segment keeping external library references.
Implementations§
Source§impl Lib
impl Lib
Sourcepub fn assemble<Isa>(code: &[Isa]) -> Result<Lib, AssemblerError>where
Isa: Instruction<LibId>,
pub fn assemble<Isa>(code: &[Isa]) -> Result<Lib, AssemblerError>where
Isa: Instruction<LibId>,
Assembles a library from the provided instructions by encoding them into bytecode.
Sourcepub fn disassemble<Isa>(&self) -> Result<Vec<Isa>, CodeEofError>where
Isa: Instruction<LibId>,
pub fn disassemble<Isa>(&self) -> Result<Vec<Isa>, CodeEofError>where
Isa: Instruction<LibId>,
Disassembles the library into a set of instructions.
Sourcepub fn print_disassemble<Isa>(&self, writer: impl Write) -> Result<(), Error>where
Isa: Instruction<LibId>,
pub fn print_disassemble<Isa>(&self, writer: impl Write) -> Result<(), Error>where
Isa: Instruction<LibId>,
Disassembles the library into a set of instructions and offsets and prints it to the writer.
Trait Implementations§
Source§impl AsciiArmor for Lib
Available on crate feature armor
only.
impl AsciiArmor for Lib
Available on crate feature
armor
only.const PLATE_TITLE: &'static str = "ALUVM LIB"
type Err = LibArmorError
fn ascii_armored_headers(&self) -> Vec<ArmorHeader>
fn to_ascii_armored_data(&self) -> Vec<u8> ⓘ
fn with_headers_data( _headers: Vec<ArmorHeader>, data: Vec<u8>, ) -> Result<Self, Self::Err>
fn to_ascii_armored_string(&self) -> String
fn display_ascii_armored(&self) -> DisplayAsciiArmored<'_, Self>
fn ascii_armored_digest(&self) -> Option<Array<u8, 32>>
fn from_ascii_armored_str(s: &str) -> Result<Self, Self::Err>
Source§impl CommitEncode for Lib
impl CommitEncode for Lib
Source§type CommitmentId = LibId
type CommitmentId = LibId
Type of the resulting commitment.
Source§fn commit_encode(&self, engine: &mut CommitEngine)
fn commit_encode(&self, engine: &mut CommitEngine)
Encodes the data for the commitment by writing them directly into a
std::io::Write
writer instanceSource§impl<'de> Deserialize<'de> for Lib
impl<'de> Deserialize<'de> for Lib
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Lib
impl Ord for Lib
Source§impl PartialOrd for Lib
impl PartialOrd for Lib
Source§impl StrictDecode for Lib
impl StrictDecode for Lib
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDeserialize for Lib
impl StrictDeserialize for Lib
fn from_strict_serialized<const MAX: usize>( ast_data: Confined<Vec<u8>, 0, MAX>, ) -> Result<Self, DeserializeError>
fn strict_deserialize<const MAX: usize>( read: impl Read, ) -> Result<Self, DeserializeError>
fn strict_deserialize_from_file<const MAX: usize>( path: impl AsRef<Path>, ) -> Result<Self, DeserializeError>
Source§impl StrictDumb for Lib
impl StrictDumb for Lib
fn strict_dumb() -> Self
Source§impl StrictEncode for Lib
impl StrictEncode for Lib
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictSerialize for Lib
impl StrictSerialize for Lib
fn strict_serialized_len<const MAX: usize>(&self) -> Result<usize, Error>
fn to_strict_serialized<const MAX: usize>( &self, ) -> Result<Confined<Vec<u8>, 0, MAX>, SerializeError>
fn strict_serialize<const MAX: usize>( &self, write: impl Write, ) -> Result<(), Error>
fn strict_serialize_to_file<const MAX: usize>( &self, path: impl AsRef<Path>, ) -> Result<(), SerializeError>
Source§impl StrictStruct for Lib
impl StrictStruct for Lib
const ALL_FIELDS: &'static [&'static str]
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for Lib
impl StrictType for Lib
const STRICT_LIB_NAME: &'static str = LIB_NAME_ALUVM
fn strict_name() -> Option<TypeName>
impl Eq for Lib
impl StrictProduct for Lib
impl StructuralPartialEq for Lib
Auto Trait Implementations§
impl Freeze for Lib
impl RefUnwindSafe for Lib
impl Send for Lib
impl Sync for Lib
impl Unpin for Lib
impl UnwindSafe for Lib
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CommitId for Twhere
T: CommitEncode,
impl<T> CommitId for Twhere
T: CommitEncode,
fn commit(&self) -> CommitEngine
Source§fn commit_id(&self) -> <T as CommitEncode>::CommitmentId
fn commit_id(&self) -> <T as CommitEncode>::CommitmentId
Performs commitment to client-side-validated data
Source§impl<T> CommitmentLayout for Twhere
T: CommitEncode + StrictDumb,
impl<T> CommitmentLayout for Twhere
T: CommitEncode + StrictDumb,
Source§fn commitment_layout() -> CommitLayout
fn commitment_layout() -> CommitLayout
Generate a descriptive commitment layout, which includes a description
of each encoded field and the used hashing strategies.
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.