pub struct Program { /* private fields */ }Expand description
Implementations§
Source§impl Program
impl Program
Sourcepub fn resolve_address(&self, id: DefinitionId) -> Option<(u32, usize)>
pub fn resolve_address(&self, id: DefinitionId) -> Option<(u32, usize)>
Resolve a definition ID to (container_idx, byte_offset).
Sourcepub fn container_bytecode(&self, idx: u32) -> &[u8] ⓘ
pub fn container_bytecode(&self, idx: u32) -> &[u8] ⓘ
Get a container’s bytecode by index.
Sourcepub fn container_count(&self) -> u32
pub fn container_count(&self) -> u32
Number of containers.
Sourcepub fn source_checksum(&self) -> u32
pub fn source_checksum(&self) -> u32
CRC-32 checksum from the source .inkb, used for transcript validation.
Sourcepub fn find_address(&self, path: &str) -> Option<(u32, usize)>
pub fn find_address(&self, path: &str) -> Option<(u32, usize)>
Resolve a qualified ink path to its (container_idx, byte_offset).
Supports knot names (intro), qualified stitches (knot.stitch), and,
for programs compiled by brink-compiler, author labels
(knot.label, knot.stitch.label). Programs without the compiler’s
address_paths table (legacy .inkb or converter output) resolve
knot/stitch scope paths only. Use this to spawn flows at named entry
points:
ⓘ
if let Some((idx, _)) = program.find_address("intro_scene") {
let (flow, ctx) = FlowInstance::new_at(program, idx);
}Sourcepub fn global_defaults(&self) -> Vec<Value>
pub fn global_defaults(&self) -> Vec<Value>
Build the initial globals vector from slot defaults.
Sourcepub fn global_name(&self, idx: u32) -> Option<&str>
pub fn global_name(&self, idx: u32) -> Option<&str>
Resolve a global slot index to its variable name.
Sourcepub fn global_count(&self) -> u32
pub fn global_count(&self) -> u32
Number of global variable slots.
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnsafeUnpin for Program
impl UnwindSafe for Program
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