pub struct Session {
pub options: Options,
pub search_paths: SearchPaths,
/* private fields */
}Expand description
The compiler session holds all state for a compilation unit.
This is the primary type for managing compilation state and should be created at the start of compilation and passed through all phases.
Fields§
§options: OptionsCompiler options.
search_paths: SearchPathsSearch paths for modules and libraries.
Implementations§
Source§impl Session
impl Session
Sourcepub fn new(options: Options) -> Result<Self, SessionError>
pub fn new(options: Options) -> Result<Self, SessionError>
Create a new session with the given options.
§Errors
Returns an error if the current working directory cannot be determined.
Sourcepub fn with_defaults() -> Result<Self, SessionError>
pub fn with_defaults() -> Result<Self, SessionError>
Create a new session with default options.
§Errors
Returns an error if the current working directory cannot be determined.
Sourcepub fn working_dir(&self) -> &Utf8Path
pub fn working_dir(&self) -> &Utf8Path
Get the working directory for this session.
Sourcepub fn is_module_loaded(&self, name: &str) -> bool
pub fn is_module_loaded(&self, name: &str) -> bool
Check if a module has been loaded (for cycle detection).
Sourcepub fn mark_module_loaded(&self, name: String)
pub fn mark_module_loaded(&self, name: String)
Mark a module as loaded.
Sourcepub fn output_path(&self, input_name: &str) -> Utf8PathBuf
pub fn output_path(&self, input_name: &str) -> Utf8PathBuf
Get the output path, computing a default if not specified.
Auto Trait Implementations§
impl !Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more