pub struct ProgramMetadata<V = Value, Ty = Type, Info = NoInfo> {
pub strings: Vec<String>,
pub functions: Vec<FunctionDecl<Ty>>,
pub constants: Vec<V>,
pub main_function: Option<u32>,
pub source_symbols: Vec<SourceSymbolInfo>,
pub extra: Info,
}Expand description
All non-code fields of a LocalModule that a section header supplies, with
every name resolved to a table index.
Fields§
§strings: Vec<String>§functions: Vec<FunctionDecl<Ty>>§constants: Vec<V>§main_function: Option<u32>§source_symbols: Vec<SourceSymbolInfo>§extra: InfoImplementations§
Source§impl<V, Ty, Info> ProgramMetadata<V, Ty, Info>
impl<V, Ty, Info> ProgramMetadata<V, Ty, Info>
Sourcepub fn map_extra<NewInfo>(
self,
map: impl FnOnce(Info) -> NewInfo,
) -> ProgramMetadata<V, Ty, NewInfo>
pub fn map_extra<NewInfo>( self, map: impl FnOnce(Info) -> NewInfo, ) -> ProgramMetadata<V, Ty, NewInfo>
Transform consumer-specific extra metadata while preserving every table.
Sourcepub fn function_name(&self, index: usize) -> Result<&str>
pub fn function_name(&self, index: usize) -> Result<&str>
The name of function declaration index, resolved through strings.
Sourcepub fn validate(
&self,
symbols: &[Symbol],
instruction_count: usize,
) -> Result<()>where
Ty: Clone,
pub fn validate(
&self,
symbols: &[Symbol],
instruction_count: usize,
) -> Result<()>where
Ty: Clone,
Validate table references and bind declarations to the symbol table, without altering the supplied metadata.
Sourcepub fn resolve_functions(
&self,
symbols: &[Symbol],
instruction_count: usize,
) -> Result<Vec<FunctionInfo<Ty>>>where
Ty: Clone,
pub fn resolve_functions(
&self,
symbols: &[Symbol],
instruction_count: usize,
) -> Result<Vec<FunctionInfo<Ty>>>where
Ty: Clone,
Bind every function declaration to its symbol and derive its range.
Returns runtime function records in metadata table order. A function
starts at its symbol’s address and ends at the next function symbol’s
address, or at instruction_count for the last function.
Source§impl<Ty: Clone, Info> ProgramMetadata<Value, Ty, Info>
impl<Ty: Clone, Info> ProgramMetadata<Value, Ty, Info>
Sourcepub fn into_module<I>(
self,
code: Vec<I>,
symbols: Vec<Symbol>,
) -> Result<LocalModule<I, Value, Ty, Info>>
pub fn into_module<I>( self, code: Vec<I>, symbols: Vec<Symbol>, ) -> Result<LocalModule<I, Value, Ty, Info>>
Assemble the standard value model, checking the supplied tables once.
Custom value models can assemble LocalModule directly after
resolve_functions.
Trait Implementations§
Source§impl<V: Clone, Ty: Clone, Info: Clone> Clone for ProgramMetadata<V, Ty, Info>
impl<V: Clone, Ty: Clone, Info: Clone> Clone for ProgramMetadata<V, Ty, Info>
Source§fn clone(&self) -> ProgramMetadata<V, Ty, Info>
fn clone(&self) -> ProgramMetadata<V, Ty, Info>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<V: PartialEq, Ty: PartialEq, Info: PartialEq> PartialEq for ProgramMetadata<V, Ty, Info>
impl<V: PartialEq, Ty: PartialEq, Info: PartialEq> PartialEq for ProgramMetadata<V, Ty, Info>
impl<V: PartialEq, Ty: PartialEq, Info: PartialEq> StructuralPartialEq for ProgramMetadata<V, Ty, Info>
Auto Trait Implementations§
impl<V, Ty, Info> Freeze for ProgramMetadata<V, Ty, Info>where
Info: Freeze,
impl<V, Ty, Info> RefUnwindSafe for ProgramMetadata<V, Ty, Info>
impl<V, Ty, Info> Send for ProgramMetadata<V, Ty, Info>
impl<V, Ty, Info> Sync for ProgramMetadata<V, Ty, Info>
impl<V, Ty, Info> Unpin for ProgramMetadata<V, Ty, Info>
impl<V, Ty, Info> UnsafeUnpin for ProgramMetadata<V, Ty, Info>where
Info: UnsafeUnpin,
impl<V, Ty, Info> UnwindSafe for ProgramMetadata<V, Ty, Info>
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,
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<T> OrderedSeq<'_, T> for Twhere
T: Clone,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].