pub trait PanicWriter {
type Config;
// Required method
fn create_panic_writer(
config: Self::Config,
_panic: &PanicInfo<'_>,
) -> impl IoWrite + Write;
}Expand description
Interface for chips to create a synchronous writer for panics.
Any mechanism that can output a panic message during a panic must implement
PanicWriter to enable the panic() functions to write the output. This
requires the mechanism to provide a new constructor for the writer that
creates a synchronous writer that implements IoWrite.
This is a dedicated trait because synchronous I/O is only used for panic handling. This allows chips to clearly separate synchronous implementations that are a special case only for panics.
Required Associated Types§
Required Methods§
Sourcefn create_panic_writer(
config: Self::Config,
_panic: &PanicInfo<'_>,
) -> impl IoWrite + Write
fn create_panic_writer( config: Self::Config, _panic: &PanicInfo<'_>, ) -> impl IoWrite + Write
Create a new synchronous writer capable of sending panic messages.
The writer must implement IoWrite (which is just std:io::Write
implemented for no_std).
This function requires a PanicInfo reference, but the implementation
should not use it. This only enforces that this function is only called
from a panic context and not during normal operation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".