Struct Program
pub struct Program(/* private fields */);Expand description
The compiled program representation.
This struct is intentionally lightweight and uses Arc internally
to allow for efficient cloning and sharing across different parts of the VM.
Implementations§
§impl Program
impl Program
pub fn new(parts: ProgramParts) -> Program
pub fn new(parts: ProgramParts) -> Program
Construct a Program from its parts.
Intended for the compiler crate. External callers normally obtain a
Program from navi_compiler::CompileOptions::compile() instead.
pub fn source_files(&self) -> &Arc<[SourceFile]>
pub fn source_files(&self) -> &Arc<[SourceFile]>
Returns all source files that were part of compilation.
pub fn entry_file(&self) -> &SourceFile
pub fn entry_file(&self) -> &SourceFile
Returns the entry source file.
pub fn variables(&self) -> &[VariableInfo]
pub fn variables(&self) -> &[VariableInfo]
Returns metadata for variables used by the program.
pub fn string_constants(&self) -> &[String]
pub fn string_constants(&self) -> &[String]
Returns the interned string constants table.
pub fn objects(&self) -> &[ObjectInfo]
pub fn objects(&self) -> &[ObjectInfo]
Returns metadata for object declarations referenced by the program.
pub fn enums(&self) -> &[EnumInfo]
pub fn enums(&self) -> &[EnumInfo]
Returns metadata for enum declarations referenced by the program.
pub fn warnings(&self) -> &[CompileDiagnostic]
pub fn warnings(&self) -> &[CompileDiagnostic]
Returns compilation warnings emitted while building this program.
pub fn expressions(&self) -> &[InternedExpr]
pub fn expressions(&self) -> &[InternedExpr]
Returns interned expressions.
pub fn module_kind(&self, file_id: u16) -> Option<ModuleKind>
pub fn module_kind(&self, file_id: u16) -> Option<ModuleKind>
Returns the module kind for the source file with the given id, or
None if the id is out of range.
pub fn ops(&self) -> &[Op]
pub fn ops(&self) -> &[Op]
Returns the flat bytecode for the main program body.
pub fn ref_ops(&self) -> &[RefOps]
pub fn ref_ops(&self) -> &[RefOps]
Returns the flat bytecodes for instruction refs (deferred expressions).
pub fn syminfo_fields(&self) -> SyminfoFields
pub fn syminfo_fields(&self) -> SyminfoFields
Returns the statically-determined set of syminfo fields accessed by
the script. DataProvider::symbol_info may use this to fetch only
the fields that are actually needed.
Trait Implementations§
§impl<'de> Deserialize<'de> for Program
impl<'de> Deserialize<'de> for Program
§fn deserialize<D>(
deserializer: D,
) -> Result<Program, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Program, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Serialize for Program
impl Serialize for Program
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.