pub struct SessionBuilder { /* private fields */ }Expand description
Session builder.
Implementations§
Source§impl SessionBuilder
 
impl SessionBuilder
Sourcepub fn dcx(self, dcx: DiagCtxt) -> SessionBuilder
 
pub fn dcx(self, dcx: DiagCtxt) -> SessionBuilder
Sets the diagnostic context.
If opts is set this will default to DiagCtxt::from_opts, otherwise this is required.
See also the with_*_emitter* methods.
Sourcepub fn source_map(self, source_map: Arc<SourceMap>) -> SessionBuilder
 
pub fn source_map(self, source_map: Arc<SourceMap>) -> SessionBuilder
Sets the source map.
Sourcepub fn opts(self, opts: Opts) -> SessionBuilder
 
pub fn opts(self, opts: Opts) -> SessionBuilder
Sets the compiler options.
Sourcepub fn with_test_emitter(self) -> SessionBuilder
 
pub fn with_test_emitter(self) -> SessionBuilder
Sets the diagnostic context to a test emitter.
Sourcepub fn with_stderr_emitter(self) -> SessionBuilder
 
pub fn with_stderr_emitter(self) -> SessionBuilder
Sets the diagnostic context to a stderr emitter.
Sourcepub fn with_stderr_emitter_and_color(
    self,
    color_choice: ColorChoice,
) -> SessionBuilder
 
pub fn with_stderr_emitter_and_color( self, color_choice: ColorChoice, ) -> SessionBuilder
Sets the diagnostic context to a stderr emitter and a color choice.
Sourcepub fn with_buffer_emitter(self, color_choice: ColorChoice) -> SessionBuilder
 
pub fn with_buffer_emitter(self, color_choice: ColorChoice) -> SessionBuilder
Sets the diagnostic context to a human emitter that emits diagnostics to a local buffer.
Sourcepub fn with_silent_emitter(self, fatal_note: Option<String>) -> SessionBuilder
 
pub fn with_silent_emitter(self, fatal_note: Option<String>) -> SessionBuilder
Sets the diagnostic context to a silent emitter.
Sourcepub fn single_threaded(self) -> SessionBuilder
 
pub fn single_threaded(self) -> SessionBuilder
Sets the number of threads to use for parallelism to 1.
Sourcepub fn threads(self, threads: usize) -> SessionBuilder
 
pub fn threads(self, threads: usize) -> SessionBuilder
Sets the number of threads to use for parallelism. Zero specifies the number of logical cores.
Sourcepub fn build(self) -> Session
 
pub fn build(self) -> Session
Consumes the builder to create a new session.
The diagnostics context must be set before calling this method, either by calling
dcx or by using one of the provided helper methods, like
with_stderr_emitter.
§Panics
Panics if:
- the diagnostics context is not set
 - the source map in the diagnostics context does not match the one set in the builder
 
Trait Implementations§
Source§impl Default for SessionBuilder
 
impl Default for SessionBuilder
Source§fn default() -> SessionBuilder
 
fn default() -> SessionBuilder
Auto Trait Implementations§
impl !Freeze for SessionBuilder
impl !RefUnwindSafe for SessionBuilder
impl Send for SessionBuilder
impl Sync for SessionBuilder
impl Unpin for SessionBuilder
impl !UnwindSafe for SessionBuilder
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, R> CollectAndApply<T, R> for T
 
impl<T, R> CollectAndApply<T, R> for 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<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