pub struct ParsedModule<I, H> {
pub header: H,
pub code: Vec<I>,
pub symbols: Vec<Symbol>,
}Expand description
One parsed SST section: its header and its flat .text stream.
I is the consumer’s instruction syntax type and H its section-header
type. .text is not structured: it is one instruction stream in which
@name: lines bind symbols to addresses without occupying a slot. What a
symbol is (for example a function’s signature) lives in the header.
Fields§
§header: H§code: Vec<I>Instructions in address order.
symbols: Vec<Symbol>Symbol definitions in source order. Each address is the index of the
next instruction in code, possibly code.len().
Implementations§
Source§impl<I, H> ParsedModule<I, H>
impl<I, H> ParsedModule<I, H>
Sourcepub fn lower_with_metadata<C, Ty: Clone, Info>(
self,
metadata: ProgramMetadata<Value, Ty, Info>,
context: &mut C,
) -> Result<LocalModule<I::Runtime, Value, Ty, Info>>where
I: Lower<C>,
C: InternedStrings,
pub fn lower_with_metadata<C, Ty: Clone, Info>(
self,
metadata: ProgramMetadata<Value, Ty, Info>,
context: &mut C,
) -> Result<LocalModule<I::Runtime, Value, Ty, Info>>where
I: Lower<C>,
C: InternedStrings,
Validate declarations, symbols, and tables, lower instructions with the supplied context, and assemble a module without inventing or reordering metadata. The module’s string table is the context’s: the metadata’s strings followed by those interned during lowering.
The consumer extracts the metadata from its chosen header schema and
prepares section-wide context capabilities (for example
MetadataLoweringContext::new(&metadata, &parsed.symbols)) before
calling this method. The header itself is not interpreted here.
§Errors
Returns declaration, symbol, table, or lowering errors. Context mutations before an error are retained; no partial module is returned.
Source§impl<I, H> ParsedModule<I, H>
impl<I, H> ParsedModule<I, H>
Sourcepub fn validate_metadata<V, Ty: Clone, Info>(
&self,
metadata: &ProgramMetadata<V, Ty, Info>,
) -> Result<()>
pub fn validate_metadata<V, Ty: Clone, Info>( &self, metadata: &ProgramMetadata<V, Ty, Info>, ) -> Result<()>
Check function declarations and the symbol table against supplied metadata without changing either.
Source§impl<I, H> ParsedModule<I, H>
impl<I, H> ParsedModule<I, H>
Sourcepub fn parse_section<'src, C>(section: SSTSectionView<'src, C>) -> Result<Self>where
H: SSTHeader,
I: Parse<'src> + 'src,
pub fn parse_section<'src, C>(section: SSTSectionView<'src, C>) -> Result<Self>where
H: SSTHeader,
I: Parse<'src> + 'src,
Parse a source section into its consumer instruction representation.
Symbol names are not checked for uniqueness here; loading validates the
table against the header metadata. On failure the error names the first
problem by file line and column; crate::spanned::parse_text reports
every problem with its span.
Trait Implementations§
Source§impl<I: Clone, H: Clone> Clone for ParsedModule<I, H>
impl<I: Clone, H: Clone> Clone for ParsedModule<I, H>
Source§fn clone(&self) -> ParsedModule<I, H>
fn clone(&self) -> ParsedModule<I, H>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<I: PartialEq, H: PartialEq> StructuralPartialEq for ParsedModule<I, H>
Auto Trait Implementations§
impl<I, H> Freeze for ParsedModule<I, H>where
H: Freeze,
impl<I, H> RefUnwindSafe for ParsedModule<I, H>where
H: RefUnwindSafe,
I: RefUnwindSafe,
impl<I, H> Send for ParsedModule<I, H>
impl<I, H> Sync for ParsedModule<I, H>
impl<I, H> Unpin for ParsedModule<I, H>
impl<I, H> UnsafeUnpin for ParsedModule<I, H>where
H: UnsafeUnpin,
impl<I, H> UnwindSafe for ParsedModule<I, H>where
H: UnwindSafe,
I: UnwindSafe,
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].