pub struct FunctionBlob {Show 21 fields
pub content_hash: FunctionHash,
pub name: String,
pub arity: u16,
pub param_names: Vec<String>,
pub locals_count: u16,
pub is_closure: bool,
pub captures_count: u16,
pub is_async: bool,
pub ref_params: Vec<bool>,
pub ref_mutates: Vec<bool>,
pub mutable_captures: Vec<bool>,
pub frame_descriptor: Option<FrameDescriptor>,
pub instructions: Vec<Instruction>,
pub constants: Vec<Constant>,
pub strings: Vec<String>,
pub required_permissions: PermissionSet,
pub dependencies: Vec<FunctionHash>,
pub callee_names: Vec<String>,
pub type_schemas: Vec<String>,
pub foreign_dependencies: Vec<[u8; 32]>,
pub source_map: Vec<(usize, u32, u32)>,
}Expand description
A self-contained, content-addressed function blob.
Each blob carries its own instructions, constants, and strings (no shared
pools). The content_hash is the SHA-256 of the serialized content fields,
making deduplication and caching trivial.
Fields§
§content_hash: FunctionHashSHA-256 hash of the serialized content (everything below).
name: String§arity: u16§param_names: Vec<String>§locals_count: u16§is_closure: bool§captures_count: u16§is_async: bool§ref_params: Vec<bool>§ref_mutates: Vec<bool>§mutable_captures: Vec<bool>§frame_descriptor: Option<FrameDescriptor>Typed frame layout for this function’s locals (propagated from compiler).
instructions: Vec<Instruction>This function’s bytecode instructions.
constants: Vec<Constant>This function’s constant pool.
strings: Vec<String>This function’s string pool.
required_permissions: PermissionSetPermissions required by this function (from capability_tags analysis).
dependencies: Vec<FunctionHash>Content hashes of functions this blob references
(Operand::Function(idx) indexes into this vector).
callee_names: Vec<String>Callee names corresponding to each dependency entry. Used during compilation to resolve forward references; not serialized.
type_schemas: Vec<String>Type names this function constructs (schema references).
foreign_dependencies: Vec<[u8; 32]>Content hashes of foreign functions referenced by CallForeign opcodes.
Sorted and deduplicated for deterministic hashing.
source_map: Vec<(usize, u32, u32)>Source mapping entries local to this blob:
(local_instruction_offset, file_id, line).
Implementations§
Source§impl FunctionBlob
impl FunctionBlob
Sourcepub fn compute_hash(&self) -> FunctionHash
pub fn compute_hash(&self) -> FunctionHash
Compute the content hash from the blob’s fields.
Call this after populating all fields, then assign the result to content_hash.
Trait Implementations§
Source§impl Clone for FunctionBlob
impl Clone for FunctionBlob
Source§fn clone(&self) -> FunctionBlob
fn clone(&self) -> FunctionBlob
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FunctionBlob
impl Debug for FunctionBlob
Source§impl<'de> Deserialize<'de> for FunctionBlob
impl<'de> Deserialize<'de> for FunctionBlob
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>,
Auto Trait Implementations§
impl Freeze for FunctionBlob
impl RefUnwindSafe for FunctionBlob
impl Send for FunctionBlob
impl Sync for FunctionBlob
impl Unpin for FunctionBlob
impl UnsafeUnpin for FunctionBlob
impl UnwindSafe for FunctionBlob
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more