pub struct Sink<T: AsyncWrite + Send + Unpin + 'static> { /* private fields */ }
Expand description
A sink to write log lines to.
§Caveats
To prevent interleaved output, you should clone a SinkHandle
instead of creating a new one if you want to write to the same sink.
§Examples
use aws_lambda_log_proxy::{Sink, SinkHandle};
#[tokio::main]
async fn main() {
let sink: SinkHandle = Sink::stdout().spawn();
let sink2 = sink.clone();
}
Implementations§
Source§impl<T: AsyncWrite + Send + Unpin + 'static> Sink<T>
impl<T: AsyncWrite + Send + Unpin + 'static> Sink<T>
Sourcepub fn new(writer: T) -> Self
pub fn new(writer: T) -> Self
Create a new Standard
sink from an AsyncWrite
implementor.
Sourcepub fn format(self, kind: OutputFormat) -> Self
pub fn format(self, kind: OutputFormat) -> Self
Set the output format of the sink.
Sourcepub fn buffer_size(self, size: usize) -> Self
pub fn buffer_size(self, size: usize) -> Self
Set the buffer size of the sink.
The default buffer size is 16
lines.
Sourcepub fn spawn(self) -> SinkHandle
pub fn spawn(self) -> SinkHandle
Spawn the sink and return a SinkHandle
to write to it.
Auto Trait Implementations§
impl<T> Freeze for Sink<T>where
T: Freeze,
impl<T> RefUnwindSafe for Sink<T>where
T: RefUnwindSafe,
impl<T> Send for Sink<T>
impl<T> Sync for Sink<T>where
T: Sync,
impl<T> Unpin for Sink<T>
impl<T> UnwindSafe for Sink<T>where
T: 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