From 314cd0e457d3ce013c3bd197b71369e26b5672de Mon Sep 17 00:00:00 2001 From: AnthonyMikh Date: Sun, 4 Jun 2023 20:38:08 +0300 Subject: [PATCH] remove Sync bound from writer for NonBlocking --- tracing-appender/src/lib.rs | 2 +- tracing-appender/src/non_blocking.rs | 6 +++--- tracing-appender/src/worker.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tracing-appender/src/lib.rs b/tracing-appender/src/lib.rs index 97ad8d4d58..6de4472b6a 100644 --- a/tracing-appender/src/lib.rs +++ b/tracing-appender/src/lib.rs @@ -174,7 +174,7 @@ pub(crate) mod sync; /// }); /// # } /// ``` -pub fn non_blocking(writer: T) -> (NonBlocking, WorkerGuard) { +pub fn non_blocking(writer: T) -> (NonBlocking, WorkerGuard) { NonBlocking::new(writer) } diff --git a/tracing-appender/src/non_blocking.rs b/tracing-appender/src/non_blocking.rs index ce25565054..c61e85c082 100644 --- a/tracing-appender/src/non_blocking.rs +++ b/tracing-appender/src/non_blocking.rs @@ -146,11 +146,11 @@ impl NonBlocking { /// /// [default]: NonBlockingBuilder::default() /// [builder]: NonBlockingBuilder - pub fn new(writer: T) -> (NonBlocking, WorkerGuard) { + pub fn new(writer: T) -> (NonBlocking, WorkerGuard) { NonBlockingBuilder::default().finish(writer) } - fn create( + fn create( writer: T, buffered_lines_limit: usize, is_lossy: bool, @@ -221,7 +221,7 @@ impl NonBlockingBuilder { } /// Completes the builder, returning the configured `NonBlocking`. - pub fn finish(self, writer: T) -> (NonBlocking, WorkerGuard) { + pub fn finish(self, writer: T) -> (NonBlocking, WorkerGuard) { NonBlocking::create( writer, self.buffered_lines_limit, diff --git a/tracing-appender/src/worker.rs b/tracing-appender/src/worker.rs index b2579fb2cd..4262257ccd 100644 --- a/tracing-appender/src/worker.rs +++ b/tracing-appender/src/worker.rs @@ -4,7 +4,7 @@ use std::fmt::Debug; use std::io::Write; use std::{io, thread}; -pub(crate) struct Worker { +pub(crate) struct Worker { writer: T, receiver: Receiver, shutdown: Receiver<()>, @@ -18,7 +18,7 @@ pub(crate) enum WorkerState { Shutdown, } -impl Worker { +impl Worker { pub(crate) fn new(receiver: Receiver, writer: T, shutdown: Receiver<()>) -> Worker { Self { writer,