pub struct LoggerStream { /* private fields */ }
Expand description
A stream bound to a socket where a source stream is captured. For example, stdout and stderr streams can be redirected to the contained socket and captured.
Implementations§
Source§impl LoggerStream
impl LoggerStream
Sourcepub fn new(socket: Socket) -> Result<LoggerStream, Status>
pub fn new(socket: Socket) -> Result<LoggerStream, Status>
Create a LoggerStream from the provided zx::Socket. The socket
object
should be bound to its intended source stream (e.g. “stdout”).
Sourcepub async fn buffer_drain_and_peek(
self,
writer: &mut SocketLogWriter,
peek_fn: Option<impl Fn(&[u8])>,
) -> Result<(), LogError>
pub async fn buffer_drain_and_peek( self, writer: &mut SocketLogWriter, peek_fn: Option<impl Fn(&[u8])>, ) -> Result<(), LogError>
Drain the stream
and write all of its contents to writer
. Bytes are
delimited by newline and each line will be passed to writer.write
individually.
An optional peek_fn
may be specified which is passed a reference to each line before
it is written.
Sourcepub async fn buffer_and_drain(
self,
writer: &mut SocketLogWriter,
) -> Result<(), LogError>
pub async fn buffer_and_drain( self, writer: &mut SocketLogWriter, ) -> Result<(), LogError>
Convenience function for buffer_drain_and_peek without a peek function.
Sourcepub fn take_socket(self) -> Socket
pub fn take_socket(self) -> Socket
Take the underlying socket of this object.
Trait Implementations§
impl Unpin for LoggerStream
Auto Trait Implementations§
impl Freeze for LoggerStream
impl !RefUnwindSafe for LoggerStream
impl Send for LoggerStream
impl Sync for LoggerStream
impl !UnwindSafe for LoggerStream
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
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more