Trait defmt::Logger [−][src]
pub unsafe trait Logger { fn acquire() -> Option<NonNull<dyn Write>>; unsafe fn release(writer: NonNull<dyn Write>); }
Expand description
Global logger acquire-release mechanism
Safety contract
acquire
returns a handle that temporarily owns the global loggeracquire
must returnSome
only once, until the handle isrelease
-dacquire
is allowed to return a handle per thread or interrupt levelacquire
is a safe function therefore it must be thread-safe and interrupt-safe- The value returned by
acquire
is notSend
so it cannot be moved between threads or interrupt handlers
And, not safety related, acquire
should never be invoked from user code. The easiest way to
ensure this is to implement Logger
on a private struct
and mark that struct
as the
#[global_logger]
.