pub struct InMemoryOutput<Ctx> { /* private fields */ }Expand description
An output implementation that just writes to a string. Produces no errors and the futures complete instantly. This type is an analogue of InMemoryIo.
Implementations§
Source§impl<Ctx> InMemoryOutput<Ctx>
impl<Ctx> InMemoryOutput<Ctx>
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.
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.
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)
Trait Implementations§
Source§impl<Ctx> Output for InMemoryOutput<Ctx>where
Ctx: Context,
impl<Ctx> Output for InMemoryOutput<Ctx>where
Ctx: Context,
Source§type Io<'b> = InMemoryIo<'b>
where
Self: 'b
type Io<'b> = InMemoryIo<'b> where Self: 'b
The I/O stream type
Source§type Error = Infallible
type Error = Infallible
The error type for write operations.
Source§async 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.
Auto Trait Implementations§
impl<Ctx> Freeze for InMemoryOutput<Ctx>where
Ctx: Freeze,
impl<Ctx> RefUnwindSafe for InMemoryOutput<Ctx>where
Ctx: RefUnwindSafe,
impl<Ctx> Send for InMemoryOutput<Ctx>where
Ctx: Send,
impl<Ctx> Sync for InMemoryOutput<Ctx>where
Ctx: Sync,
impl<Ctx> Unpin for InMemoryOutput<Ctx>where
Ctx: Unpin,
impl<Ctx> UnwindSafe for InMemoryOutput<Ctx>where
Ctx: UnwindSafe,
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
Mutably borrows from an owned value. Read more