pub trait Output {
type IO: IoOutput;
type Ctx: Context;
type Error: From<Error>;
// Required methods
async fn write(&mut self, value: &str) -> Result<(), Self::Error>;
fn split(&mut self) -> (&mut Self::IO, &Self::Ctx);
fn context(&self) -> &Self::Ctx;
// Provided method
fn get_ctx<T>(&self) -> &T
where Self::Ctx: ContextProvides<T> { ... }
}Expand description
Code generation output. This is a high-level trait intended to represent wherever you’re writing to, with associated context. It can be split into that context in order to separate the I/O stream itself.
Required Associated Types§
Required Methods§
Sourceasync fn write(&mut self, value: &str) -> Result<(), Self::Error>
async fn write(&mut self, value: &str) -> Result<(), Self::Error>
Writes the given value to the output.
Provided Methods§
Sourcefn get_ctx<T>(&self) -> &Twhere
Self::Ctx: ContextProvides<T>,
fn get_ctx<T>(&self) -> &Twhere
Self::Ctx: ContextProvides<T>,
Gets a particular context value
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.