Trait miden_assembly::Compile

source ·
pub trait Compile: Sized {
    // Required method
    fn compile_with_options(
        self,
        source_manager: &dyn SourceManager,
        options: Options,
    ) -> Result<Box<Module>, Report>;

    // Provided method
    fn compile(
        self,
        source_manager: &dyn SourceManager,
    ) -> Result<Box<Module>, Report> { ... }
}
Expand description

This trait is meant to be implemented by any type that can be compiled to a Module, to allow methods which expect a Module to accept things like:

  • A Module which was previously parsed or deserialized
  • A string representing the source code of a Module.
  • A path to a file containing the source code of a Module.
  • A vector of crate::ast::Forms comprising the contents of a Module.

Required Methods§

source

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

Compile (or convert) self into a Module using the provided options.

Returns a Report if compilation fails due to a parsing or semantic analysis error, or if the module provided is of the wrong kind (e.g. we expected a library module but got an executable module).

See the documentation for Options to see how compilation can be configured.

Provided Methods§

source

fn compile( self, source_manager: &dyn SourceManager, ) -> Result<Box<Module>, Report>

Compile (or convert) self into an executable Module.

See Compile::compile_with_options() for more details.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Compile for Box<str>

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl Compile for Box<Module>

source§

fn compile_with_options( self, _source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl Compile for Box<[u8]>

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl Compile for String

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl Compile for Arc<Module>

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl Compile for Arc<SourceFile>

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl Compile for Vec<u8>

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl Compile for PathBuf

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl<'a> Compile for &'a str

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl<'a> Compile for &'a String

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl<'a> Compile for &'a Path

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl<'a> Compile for &'a [u8]

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

source§

impl<'a> Compile for Cow<'a, str>

source§

fn compile_with_options( self, source_manager: &dyn SourceManager, options: Options, ) -> Result<Box<Module>, Report>

Implementors§

source§

impl Compile for Module

source§

impl<'a> Compile for &'a Module

source§

impl<T> Compile for NamedSource<T>
where T: SourceCode + AsRef<[u8]>,