pub struct LogSink(/* private fields */);Expand description
A shared, bounded ring-buffer sink for LogEntry items.
Wraps Arc<Mutex<VecDeque<LogEntry>>> and enforces a maximum capacity
of 20 entries. Oldest entries are evicted when the cap is exceeded.
LogSink can be cloned cheaply (clones the Arc, not the buffer).
It is intended to be passed to the Lua bridge so that log output from
both print() and alc.log() is routed into the session’s ring buffer.
Implementations§
Source§impl LogSink
impl LogSink
Sourcepub fn push(&self, entry: LogEntry)
pub fn push(&self, entry: LogEntry)
Push a new entry into the ring buffer, evicting the oldest if necessary.
§Arguments
entry— TheLogEntryto append.
§Errors
If the internal mutex is poisoned (only possible on OOM-induced panic), the entry is silently dropped. This is the approved “observation/recording” policy — log capture failure must not interrupt execution.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogSink
impl RefUnwindSafe for LogSink
impl Send for LogSink
impl Sync for LogSink
impl Unpin for LogSink
impl UnsafeUnpin for LogSink
impl UnwindSafe for LogSink
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