pub trait Scope: Sized {
type Errors: ErrorAccumulator;
type Indent: IndentTracker;
Show 13 methods
// Required methods
fn indent(&self) -> impl Display;
fn push_indent(&self) -> Self;
fn options(&self) -> &OutputOptions;
fn extensions(&self) -> &SimpleExtensions;
fn errors(&self) -> &Self::Errors;
// Provided methods
fn push_error(&self, e: FormatError) { ... }
fn failure<E: Into<FormatError>>(&self, e: E) -> ErrorToken { ... }
fn expect<'a, T: Textify>(
&'a self,
t: Option<&'a T>,
) -> MaybeToken<impl Display> { ... }
fn expect_ok<'a, T: Textify, E: Into<FormatError>>(
&'a self,
result: Result<&'a T, E>,
) -> MaybeToken<impl Display + 'a> { ... }
fn display<'a, T: Textify>(
&'a self,
value: &'a T,
) -> Displayable<'a, Self, T> { ... }
fn separated<'a, T: Textify, I: IntoIterator<Item = &'a T> + Clone>(
&'a self,
items: I,
separator: &'static str,
) -> Separated<'a, Self, T, I> { ... }
fn option<'a, T: Textify>(
&'a self,
value: Option<&'a T>,
) -> OptionalDisplayable<'a, Self, T> { ... }
fn optional<'a, T: Textify>(
&'a self,
value: &'a T,
option: bool,
) -> OptionalDisplayable<'a, Self, T> { ... }
}
Expand description
Holds the context for outputting a plan.
This includes:
- Options (
&
OutputOptions
) for formatting - Errors (
&
ErrorAccumulator
) for collecting errors - Extensions (
&
SimpleExtensions
) for looking up function and type names - Indent (
&
IndentTracker
) for tracking the current indent level
The Scope
trait is used to provide the context for textifying a plan.
Required Associated Types§
Sourcetype Errors: ErrorAccumulator
type Errors: ErrorAccumulator
The type of errors that can occur when textifying a plan.
type Indent: IndentTracker
Required Methods§
Sourcefn push_indent(&self) -> Self
fn push_indent(&self) -> Self
Push a new indent level.
Sourcefn options(&self) -> &OutputOptions
fn options(&self) -> &OutputOptions
Get the options for formatting the plan.
fn extensions(&self) -> &SimpleExtensions
fn errors(&self) -> &Self::Errors
Provided Methods§
fn push_error(&self, e: FormatError)
Sourcefn failure<E: Into<FormatError>>(&self, e: E) -> ErrorToken
fn failure<E: Into<FormatError>>(&self, e: E) -> ErrorToken
Handle a failure to textify a value. Textify errors are written as “!{name}” to the output (where “name” is the type name), and the error is pushed to the error accumulator.
fn expect<'a, T: Textify>( &'a self, t: Option<&'a T>, ) -> MaybeToken<impl Display>
fn expect_ok<'a, T: Textify, E: Into<FormatError>>( &'a self, result: Result<&'a T, E>, ) -> MaybeToken<impl Display + 'a>
fn display<'a, T: Textify>(&'a self, value: &'a T) -> Displayable<'a, Self, T>
Sourcefn separated<'a, T: Textify, I: IntoIterator<Item = &'a T> + Clone>(
&'a self,
items: I,
separator: &'static str,
) -> Separated<'a, Self, T, I>
fn separated<'a, T: Textify, I: IntoIterator<Item = &'a T> + Clone>( &'a self, items: I, separator: &'static str, ) -> Separated<'a, Self, T, I>
fn option<'a, T: Textify>( &'a self, value: Option<&'a T>, ) -> OptionalDisplayable<'a, Self, T>
fn optional<'a, T: Textify>( &'a self, value: &'a T, option: bool, ) -> OptionalDisplayable<'a, Self, T>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.