pub trait FmtWithCtx<C> {
// Required method
fn fmt_with_ctx(&self, ctx: &C, f: &mut Formatter<'_>) -> Result;
// Provided methods
fn with_ctx<'a>(&'a self, ctx: &'a C) -> WithCtx<'a, C, Self> { ... }
fn to_string_with_ctx(&self, ctx: &C) -> String { ... }
}
Expand description
Format the AST type as a string.
Required Methods§
fn fmt_with_ctx(&self, ctx: &C, f: &mut Formatter<'_>) -> Result
Provided Methods§
Sourcefn with_ctx<'a>(&'a self, ctx: &'a C) -> WithCtx<'a, C, Self>
fn with_ctx<'a>(&'a self, ctx: &'a C) -> WithCtx<'a, C, Self>
Returns a struct that implements Display
. This allows the following:
println!("{}", self.with_ctx(ctx));
fn to_string_with_ctx(&self, ctx: &C) -> String
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.