[−][src]Trait defmt::Logger
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]
.
Required methods
pub fn acquire() -> Option<NonNull<dyn Write>>
[src]
Returns a handle to the global logger
For the requirements of the method see the documentation of the Logger
trait
pub unsafe fn release(writer: NonNull<dyn Write>)
[src]
Releases the global logger
Safety
writer
argument must be a value previously returned by Self::acquire
and not, say,
NonNull::dangling()