Trait delog::Delogger

source ·
pub unsafe trait Delogger: Log + TryLog + State<&'static AtomicUsize> {
    // Required methods
    fn buffer(&self) -> &'static mut [u8] ;
    fn claimed(&self) -> &'static AtomicUsize;
    fn flush(&self, logs: &str);
    fn render(&self, record: &Record<'_>) -> &'static [u8] ;

    // Provided method
    fn capacity(&self) -> usize { ... }
}
Expand description

Semi-abstract characterization of the deferred loggers that the delog! macro produces.

Safety

This trait is markes “unsafe” to signal that users should never (need to) “write their own”, but always go through the delog! macro.

The user has access to the global logger via delog::logger(), but only as TryLog/Log implementation, not with this direct access to implementation details.

Required Methods§

source

fn buffer(&self) -> &'static mut [u8]

the underlying buffer

source

fn claimed(&self) -> &'static AtomicUsize

How many characters were claimed so far.

source

fn flush(&self, logs: &str)

Call the flusher.

source

fn render(&self, record: &Record<'_>) -> &'static [u8]

Actually render the arguments (via internal static buffer).

Provided Methods§

source

fn capacity(&self) -> usize

Capacity of circular buffer.

Implementors§