Struct midenc_session::Session
source · pub struct Session {
pub name: String,
pub options: Options,
pub source_manager: Arc<dyn SourceManager>,
pub diagnostics: Arc<DiagnosticsHandler>,
pub inputs: Vec<InputFile>,
pub output_files: OutputFiles,
pub statistics: Statistics,
}Expand description
This struct provides access to all of the metadata and configuration needed during a single compilation session.
Fields§
§name: StringThe name of this session
options: OptionsConfiguration for the current compiler session
source_manager: Arc<dyn SourceManager>The current source manager
diagnostics: Arc<DiagnosticsHandler>The current diagnostics handler
inputs: Vec<InputFile>The inputs being compiled
output_files: OutputFilesThe outputs to be produced by the compiler during compilation
statistics: StatisticsStatistics gathered from the current compiler session
Implementations§
source§impl Session
impl Session
pub fn new<I>(
inputs: I,
output_dir: Option<PathBuf>,
output_file: Option<OutputFile>,
target_dir: PathBuf,
options: Options,
emitter: Option<Arc<dyn Emitter>>,
source_manager: Arc<dyn SourceManager>,
) -> Selfwhere
I: IntoIterator<Item = InputFile>,
pub fn with_project_type(self, ty: ProjectType) -> Self
sourcepub fn get_flag(&self, name: &str) -> bool
pub fn get_flag(&self, name: &str) -> bool
Get the value of a custom flag with action FlagAction::SetTrue or FlagAction::SetFalse
sourcepub fn get_flag_count(&self, name: &str) -> usize
pub fn get_flag_count(&self, name: &str) -> usize
Get the count of a specific custom flag with action FlagAction::Count
sourcepub fn get_flag_value<T>(&self, name: &str) -> Option<&T>
pub fn get_flag_value<T>(&self, name: &str) -> Option<&T>
Get the value of a specific custom flag
sourcepub fn get_flag_values<T>(&self, name: &str) -> Option<ValuesRef<'_, T>>
pub fn get_flag_values<T>(&self, name: &str) -> Option<ValuesRef<'_, T>>
Iterate over values of a specific custom flag
sourcepub fn matches(&self) -> &ArgMatches
pub fn matches(&self) -> &ArgMatches
Get the remaining clap::ArgMatches left after parsing the base session configuration
sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The name of this session (used as the name of the project, output file, etc.)
sourcepub fn out_file(&self) -> OutputFile
pub fn out_file(&self) -> OutputFile
Get the OutputFile to write the assembled MAST output to
sourcepub fn parse_only(&self) -> bool
pub fn parse_only(&self) -> bool
Returns true if the compiler should exit after parsing the input
sourcepub fn analyze_only(&self) -> bool
pub fn analyze_only(&self) -> bool
Returns true if the compiler should exit after performing semantic analysis
sourcepub fn rewrite_only(&self) -> bool
pub fn rewrite_only(&self) -> bool
Returns true if the compiler should exit after applying rewrites to the IR
sourcepub fn should_link(&self) -> bool
pub fn should_link(&self) -> bool
Returns true if an OutputType that requires linking + assembly was requested
sourcepub fn should_codegen(&self) -> bool
pub fn should_codegen(&self) -> bool
Returns true if an OutputType that requires generating Miden Assembly was requested
sourcepub fn should_assemble(&self) -> bool
pub fn should_assemble(&self) -> bool
Returns true if an OutputType that requires assembling MAST was requested
sourcepub fn should_emit(&self, ty: OutputType) -> bool
pub fn should_emit(&self, ty: OutputType) -> bool
Returns true if the given OutputType should be emitted as an output
sourcepub fn should_print_ir(&self, pass: &str) -> bool
pub fn should_print_ir(&self, pass: &str) -> bool
Returns true if IR should be printed to stdout, after executing a pass named pass
sourcepub fn should_print_cfg(&self, pass: &str) -> bool
pub fn should_print_cfg(&self, pass: &str) -> bool
Returns true if CFG should be printed to stdout, after executing a pass named pass
sourcepub fn print(&self, ir: impl Emit, pass: &str) -> Result<()>
pub fn print(&self, ir: impl Emit, pass: &str) -> Result<()>
Print the given emittable IR to stdout, as produced by a pass with name pass
sourcepub fn emit_to(&self, ty: OutputType, name: Option<Symbol>) -> Option<PathBuf>
pub fn emit_to(&self, ty: OutputType, name: Option<Symbol>) -> Option<PathBuf>
Get the path to emit the given OutputType to
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Session
impl !RefUnwindSafe for Session
impl !Send for Session
impl !Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moresource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more