Skip to main content

FunctionBlob

Struct FunctionBlob 

Source
pub struct FunctionBlob {
Show 20 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 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: FunctionHash

SHA-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>§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: PermissionSet

Permissions 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

Source

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.

Source

pub fn finalize(&mut self)

Build a blob with all fields set, then compute and assign its content hash.

Trait Implementations§

Source§

impl Clone for FunctionBlob

Source§

fn clone(&self) -> FunctionBlob

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionBlob

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FunctionBlob

Source§

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 Serialize for FunctionBlob

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,