Struct PanicMessage
pub struct PanicMessage<'a> { pub(in ::panic::panic_info) message: &'a Arguments<'a> }
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.
Fields
message: &'a Arguments<'a>
Implementations
impl<'a> PanicMessage<'a>
const 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 returnSome("just a literal").For most cases with placeholders, this function will return
None.See
fmt::Arguments::as_strfor details.
Trait Implementations
impl Debug for PanicMessage<'_>
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
impl Display for PanicMessage<'_>
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<'a> !Send for PanicMessage<'a>
impl<'a> !Sync for PanicMessage<'a>
impl<'a> Freeze for PanicMessage<'a>
impl<'a> RefUnwindSafe for PanicMessage<'a>
impl<'a> Unpin for PanicMessage<'a>
impl<'a> UnsafeUnpin for PanicMessage<'a>
impl<'a> UnwindSafe for PanicMessage<'a>
Blanket Implementations
impl<T> Any for PanicMessage<'a>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for PanicMessage<'a>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for PanicMessage<'a>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for PanicMessage<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for PanicMessage<'a>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for PanicMessage<'a>
impl<T, U> Into<U> for PanicMessage<'a>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for PanicMessage<'a>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for PanicMessage<'a>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>