pub struct PanicMessage<'a> { /* private fields */ }
Expand description
A message that was given to the panic!()
macro.
The Display
implementation of this type will format the message with the arguments
that were given to the panic!()
macro.
See PanicInfo::message
.
Implementations§
source§impl<'a> PanicMessage<'a>
impl<'a> PanicMessage<'a>
1.81.0 (const: unstable) · sourcepub fn as_str(&self) -> Option<&'static str>
pub fn as_str(&self) -> Option<&'static str>
Gets the formatted message, if it has no arguments to be formatted at runtime.
This can be used to avoid allocations in some cases.
§Guarantees
For panic!("just a literal")
, this function is guaranteed to
return Some("just a literal")
.
For most cases with placeholders, this function will return None
.
See fmt::Arguments::as_str
for details.
Trait Implementations§
1.81.0 · source§impl Debug for PanicMessage<'_>
impl Debug for PanicMessage<'_>
Auto Trait Implementations§
impl<'a> Freeze for PanicMessage<'a>
impl<'a> RefUnwindSafe for PanicMessage<'a>
impl<'a> !Send for PanicMessage<'a>
impl<'a> !Sync for PanicMessage<'a>
impl<'a> Unpin for PanicMessage<'a>
impl<'a> UnwindSafe for PanicMessage<'a>
Blanket Implementations§
source§impl<T> AsCleanDebug for Twhere
T: Display,
impl<T> AsCleanDebug for Twhere
T: Display,
source§fn as_clean(&self) -> CleanDebug<'_, Self>where
Self: Display,
fn as_clean(&self) -> CleanDebug<'_, Self>where
Self: Display,
Get a
CleanDebug
for Self. Read moresource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string()
Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString
. Read more