pub struct StreamSink(/* private fields */);Implementations§
Source§impl StreamSink
impl StreamSink
pub fn new(writer: impl Write + 'static) -> Self
pub fn process_stdout() -> Self
Sourcepub fn redirect(&self, writer: impl Write + 'static)
pub fn redirect(&self, writer: impl Write + 'static)
Replace the destination; every clone of this sink follows.
Sourcepub fn redirect_on_first_write<W: Write + 'static>(
&self,
open: impl FnOnce() -> Result<W> + 'static,
)
pub fn redirect_on_first_write<W: Write + 'static>( &self, open: impl FnOnce() -> Result<W> + 'static, )
Replace the destination when there is a first byte to write, so a run that writes none leaves the writer unopened. Failing to open it fails that write and every later one.
Sourcepub fn cancel_pending_redirect(&self)
pub fn cancel_pending_redirect(&self)
Drop a destination redirect_on_first_write
armed but never needed, so the run keeps the destination it had.
pub fn with_writer<R>(&self, write: impl FnOnce(&mut dyn Write) -> R) -> R
Sourcepub fn write_line(&self, bytes: &[u8]) -> Result<()>
pub fn write_line(&self, bytes: &[u8]) -> Result<()>
One write of bytes and the newline that terminates it, then a flush.
Trait Implementations§
Source§impl Clone for StreamSink
impl Clone for StreamSink
Source§fn clone(&self) -> StreamSink
fn clone(&self) -> StreamSink
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for StreamSink
impl !Send for StreamSink
impl !Sync for StreamSink
impl !UnwindSafe for StreamSink
impl Freeze for StreamSink
impl Unpin for StreamSink
impl UnsafeUnpin for StreamSink
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