pub struct PanicSlot<'a> { /* private fields */ }Expand description
Framing wrapper around a borrowed RAM region.
One instance is constructed at boot from the BSP-provided
&'static mut [u8]. Pass the same region (the literal same RAM,
not a fresh copy) every reset so the previous boot’s panic can be
recovered.
Implementations§
Source§impl<'a> PanicSlot<'a>
impl<'a> PanicSlot<'a>
Sourcepub fn new(region: &'a mut [u8]) -> Self
pub fn new(region: &'a mut [u8]) -> Self
Wrap a RAM region. Region must be at least
[HEADER_LEN] + 1 byte; smaller regions panic in debug and
silently truncate writes to zero payload bytes in release.
Sourcepub fn payload_capacity(&self) -> usize
pub fn payload_capacity(&self) -> usize
Capacity available for payload bytes.
Sourcepub fn capture(&mut self, msg: &[u8]) -> usize
pub fn capture(&mut self, msg: &[u8]) -> usize
Write a panic message. Truncates if msg is larger than the
payload capacity. Returns the number of payload bytes actually
stored. Designed to be callable from a panic handler, so it
allocates nothing and uses only direct slice writes.