vihaco_bytecode (crate)
vihaco_bytecode¶
vihaco_bytecode
classBytecodeFile¶source
vihaco_bytecode::BytecodeFile
Bases: Debug, Clone
Rust struct. A parsed bytecode file.
pub struct BytecodeFile<C>methodcontext¶source
vihaco_bytecode::BytecodeFile::context
methodcontext_handle¶source
vihaco_bytecode::BytecodeFile::context_handle
methodfrom_bytes¶source
vihaco_bytecode::BytecodeFile::from_bytes
pub fn from_bytes(bytes: Vec<u8>) -> Result<Self>Parameters
| Name | Type | Description |
|---|---|---|
bytes | Vec<u8> |
Returns
Result<Self>
Parse a bytecode file from bytes.
sourcemethodroot¶source
vihaco_bytecode::BytecodeFile::root
pub fn root(&self) -> BytecodeSectionView<'_, C>Returns
BytecodeSectionView<'_, C>
The view of the root of the bytecode section tree.
sourceclassBytecodeSectionView¶source
vihaco_bytecode::BytecodeSectionView
Bases: Clone, Debug
Rust struct. A lightweight view into a parsed bytecode section.
pub struct BytecodeSectionView<'bc, C>methodbytecode¶source
vihaco_bytecode::BytecodeSectionView::bytecode
methodchild¶source
vihaco_bytecode::BytecodeSectionView::child
Signature
pub fn child(&self, local_name: &str) -> Option<BytecodeSectionView<'bc, C>>Parameters
| Name | Type | Description |
|---|---|---|
local_name | &str |
Returns
Option<BytecodeSectionView<'bc, C>>
methodchildren¶source
vihaco_bytecode::BytecodeSectionView::children
methodcontext_handle¶source
vihaco_bytecode::BytecodeSectionView::context_handle
methoddecode_header¶source
vihaco_bytecode::BytecodeSectionView::decode_header
pub fn decode_header<H: BytecodeHeader>(&self) -> Result<H>Returns
Result<H>
Decode the specified composite header from raw header bytes.
sourcemethoddecode_instructions¶source
vihaco_bytecode::BytecodeSectionView::decode_instructions
pub fn decode_instructions<I: Instruction>(&self) -> Result<Vec<I>>Returns
Result<Vec<I>>
Decode this section’s bytecode body as an instruction stream.
sourcemethoddisplay_path¶source
vihaco_bytecode::BytecodeSectionView::display_path
methodheader_bytes¶source
vihaco_bytecode::BytecodeSectionView::header_bytes
methodlocal_name¶source
vihaco_bytecode::BytecodeSectionView::local_name
methodpath¶source
vihaco_bytecode::BytecodeSectionView::path
classConstantId¶source
vihaco_bytecode::ConstantId
Bases: Debug, Clone, Copy, StructuralPartialEq, PartialEq, Eq, PartialOrd, Ord, Hash, From<u32>, From<ConstantId>, FromBytes, WriteBytes, OpCode, Display
Rust struct.
classContextHandle¶source
vihaco_bytecode::ContextHandle
Bases: Debug, Clone, Deref
Rust struct. The public handle for a global context.
pub struct ContextHandle<C>To avoid needing explicit lifetimes permeating throughout machine definitions, we wrap the context in an Arc to drop it automatically.
sourcemethodget¶source
vihaco_bytecode::ContextHandle::get
methodnew¶source
vihaco_bytecode::ContextHandle::new
methodptr_eq¶source
vihaco_bytecode::ContextHandle::ptr_eq
pub fn ptr_eq(&self, other: &Self) -> boolParameters
| Name | Type | Description |
|---|---|---|
other | &Self |
Returns
bool
classNoContext¶source
vihaco_bytecode::NoContext
Bases: Debug, Clone, Copy, Default, StructuralPartialEq, PartialEq, Eq, PartialOrd, Ord, Hash, SstGlobalContext
Rust struct. Marker context for SST files that do not carry global metadata.
classSectionPath¶source
vihaco_bytecode::SectionPath
Bases: Clone, StructuralPartialEq, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Display, Debug
Rust struct. The fully resolved path for a parsed section.
classSstFile¶source
vihaco_bytecode::SstFile
Bases: Debug, Clone
Rust struct. A parsed SST file.
pub struct SstFile<C>methodcontext¶source
vihaco_bytecode::SstFile::context
methodcontext_handle¶source
vihaco_bytecode::SstFile::context_handle
methodfrom_text¶source
vihaco_bytecode::SstFile::from_text
pub fn from_text(text: &str) -> Result<Self>Parameters
| Name | Type | Description |
|---|---|---|
text | &str |
Returns
Result<Self>
Parse an SST file from text.
sourcemethodroot¶source
vihaco_bytecode::SstFile::root
pub fn root(&self) -> SstSectionView<'_, C>Returns
SstSectionView<'_, C>
The view of the root of the SST section tree.
sourceclassSstSectionView¶source
vihaco_bytecode::SstSectionView
Bases: Clone, Debug
Rust struct. A lightweight view into a parsed SST section.
pub struct SstSectionView<'bc, C>methodchild¶source
vihaco_bytecode::SstSectionView::child
pub fn child(&self, local_name: &str) -> Option<SstSectionView<'bc, C>>Parameters
| Name | Type | Description |
|---|---|---|
local_name | &str |
Returns
Option<SstSectionView<'bc, C>>
methodchildren¶source
vihaco_bytecode::SstSectionView::children
methodcontext_handle¶source
vihaco_bytecode::SstSectionView::context_handle
methoddisplay_path¶source
vihaco_bytecode::SstSectionView::display_path
methodheader_text¶source
vihaco_bytecode::SstSectionView::header_text
methodlocal_name¶source
vihaco_bytecode::SstSectionView::local_name
methodparse_header¶source
vihaco_bytecode::SstSectionView::parse_header
pub fn parse_header<H: SstHeader>(&self) -> Result<H>Returns
Result<H>
Parse the specified composite header from SST header text.
sourcemethodpath¶source
vihaco_bytecode::SstSectionView::path
methodsst¶source
vihaco_bytecode::SstSectionView::sst
classBytecodeGlobalContext¶source
vihaco_bytecode::BytecodeGlobalContext
Rust trait. A global context that can be decoded from bytecode.
classBytecodeHeader¶source
vihaco_bytecode::BytecodeHeader
Rust trait.
pub trait BytecodeHeader: Sized + FromBytesclassGlobalContext¶source
vihaco_bytecode::GlobalContext
Rust trait. A global context that supports both bytecode and SST representations.
pub trait GlobalContext: BytecodeGlobalContext + SstGlobalContextclassSectionNameResolver¶source
vihaco_bytecode::SectionNameResolver
Rust trait. Resolve section-name indexes stored in bytecode files.
pub trait SectionNameResolverBytecode child section entries store section names indirectly, so parsing a bytecode file needs a context object that can resolve those indexes.
sourcemethodsection_name¶source
vihaco_bytecode::SectionNameResolver::section_name
fn section_name(&self, index: u32) -> Option<&str>Parameters
| Name | Type | Description |
|---|---|---|
index | u32 |
Returns
Option<&str>
classSstGlobalContext¶source
vihaco_bytecode::SstGlobalContext
Rust trait. A global context that can be parsed from SST text.
classSstHeader¶source
vihaco_bytecode::SstHeader
Rust trait.
pub trait SstHeader: Sized + FromTextclassWriteBytecodeHeader¶source
vihaco_bytecode::WriteBytecodeHeader
Rust trait.
pub trait WriteBytecodeHeader: WriteBytespropertyFLAGS¶
vihaco_bytecode::FLAGS
pub const FLAGS: u16propertyMAGIC¶
vihaco_bytecode::MAGIC
pub const MAGIC: &[u8; 4]propertyVERSION¶
vihaco_bytecode::VERSION
pub const VERSION: u16functiondecode_instruction_stream¶source
vihaco_bytecode::decode_instruction_stream
Signature
pub fn decode_instruction_stream<I: Instruction>(bytes: &[u8]) -> Result<Vec<I>>Parameters
| Name | Type | Description |
|---|---|---|
bytes | &[u8] |
Returns
Result<Vec<I>>