Struct miden_assembly::Module
source · pub struct Module {
pub path: LibraryPath,
pub ast: ModuleAst,
}Expand description
A module containing its absolute path and parsed AST.
Fields§
§path: LibraryPathAbsolute path of the module.
ast: ModuleAstParsed AST of the module.
Implementations§
source§impl Module
impl Module
sourcepub const fn new(path: LibraryPath, ast: ModuleAst) -> Self
pub const fn new(path: LibraryPath, ast: ModuleAst) -> Self
Create a new module from a path and ast.
sourcepub fn kernel(ast: ModuleAst) -> Self
pub fn kernel(ast: ModuleAst) -> Self
Create a new kernel module from a AST using the constant LibraryPath::kernel_path.
sourcepub fn check_namespace(
&self,
namespace: &LibraryNamespace
) -> Result<(), LibraryError>
pub fn check_namespace( &self, namespace: &LibraryNamespace ) -> Result<(), LibraryError>
Validate if the module belongs to the provided namespace.
sourcepub fn clear_locations(&mut self)
pub fn clear_locations(&mut self)
Clears the source locations from this module.
sourcepub fn load_source_locations<R: ByteReader>(
&mut self,
source: &mut R
) -> Result<(), DeserializationError>
pub fn load_source_locations<R: ByteReader>( &mut self, source: &mut R ) -> Result<(), DeserializationError>
Loads the [SourceLocation] of the procedures via ModuleAst::load_source_locations.
sourcepub fn write_source_locations<W: ByteWriter>(&self, target: &mut W)
pub fn write_source_locations<W: ByteWriter>(&self, target: &mut W)
Writes the [SourceLocation] of the procedures via ModuleAst::write_source_locations.
sourcepub fn write_into<W: ByteWriter>(
&self,
target: &mut W,
options: AstSerdeOptions
)
pub fn write_into<W: ByteWriter>( &self, target: &mut W, options: AstSerdeOptions )
Serialization of Module via LibraryPath::write_into and ModuleAst::write_into. AstSerdeOptions are used to direct serialization of ModuleAst.
sourcepub fn read_from<R: ByteReader>(
source: &mut R,
options: AstSerdeOptions
) -> Result<Self, DeserializationError>
pub fn read_from<R: ByteReader>( source: &mut R, options: AstSerdeOptions ) -> Result<Self, DeserializationError>
Deserialization of Module via LibraryPath::read_from and ModuleAst::read_from. AstSerdeOptions are used to direct deserialization of ModuleAst.
Trait Implementations§
source§impl Ord for Module
impl Ord for Module
source§impl PartialEq for Module
impl PartialEq for Module
source§impl PartialOrd for Module
impl PartialOrd for Module
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more