pub struct InMemoryOutput<Ctx, Err = Infallible> { /* private fields */ }Expand description
An output implementation that just writes to a string.
This output itself produces no errors and the write futures complete instantly. It uses InMemoryIo as the IO type.
However, for compatibility with higher level code that uses a different error type, the
error type can be selected by the type parameter Err. Note that Err must be convertible
from Infallible. Regardless of the error type chosen, it will never be returned from this
output itself.
Implementations§
Source§impl<Ctx, Err> InMemoryOutput<Ctx, Err>
impl<Ctx, Err> InMemoryOutput<Ctx, Err>
Source§impl<Ctx, Err> InMemoryOutput<Ctx, Err>
impl<Ctx, Err> InMemoryOutput<Ctx, Err>
Sourcepub fn try_print_output<W>(context: Ctx, writable: &W) -> Result<String, Err>where
W: Writable<Self>,
pub fn try_print_output<W>(context: Ctx, writable: &W) -> Result<String, Err>where
W: Writable<Self>,
Gets the string output of a single writable.
Assumes that the only source of async is this InMemoryOutput itself, i.e. the writable will never return a pending future unless the output used with it returns a pending future. Because of its async-rejecting nature, this function is intended for testing purposes.
Panics if the writable returns a pending future (particularly, this may happen if a writable introduces its own async computations that do not come from the output)
Source§impl<Ctx> InMemoryOutput<Ctx>where
Ctx: Context,
impl<Ctx> InMemoryOutput<Ctx>where
Ctx: Context,
Sourcepub fn print_output<W>(context: Ctx, writable: &W) -> Stringwhere
W: Writable<Self>,
pub fn print_output<W>(context: Ctx, writable: &W) -> Stringwhere
W: Writable<Self>,
Gets the string output of a single writable.
Infallible version of [try_print_output]. See that function’s documentation for full details.
Panics if the writable returns a pending future (particularly, this may happen if a writable introduces its own async computations that do not come from the output)