pub struct SharedPrinterSlot { /* private fields */ }Expand description
Shared slot holding an optional [NonBlockingPrinter].
Created before tracing subscriber init, shared with both the
tracing MakeWriter and OrcsApp.
- Printer set → tracing and IOOutput go through NonBlockingPrinter (preserves rustyline prompt, never blocks)
- Printer empty → fallback to stderr (startup, shutdown, non-interactive)
Implementations§
Sourcepub fn set(&self, printer: Box<dyn ExternalPrinter + Send>)
pub fn set(&self, printer: Box<dyn ExternalPrinter + Send>)
Installs an ExternalPrinter into the slot, wrapped in a
[NonBlockingPrinter] for deadlock-free operation.
All subsequent try_print() calls will route through this printer.
Sourcepub fn clear(&self)
pub fn clear(&self)
Removes the printer from the slot.
The [NonBlockingPrinter] is dropped, which drops the SyncSender,
causing the drain thread to exit cleanly.
Sourcepub fn try_print(&self, msg: String) -> PrintResult
pub fn try_print(&self, msg: String) -> PrintResult
Attempts to print a message through the non-blocking printer.
Returns PrintResult indicating the outcome:
Trait Implementations§
Source§fn clone(&self) -> SharedPrinterSlot
fn clone(&self) -> SharedPrinterSlot
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§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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