Struct PanicMessage

struct PanicMessage<'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.

Implementations

impl<'a> PanicMessage<'a>

const fn as_str(self: &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.

impl Debug for PanicMessage<'_>

fn fmt(self: &Self, formatter: &mut Formatter<'_>) -> Result

impl Display for PanicMessage<'_>

fn fmt(self: &Self, formatter: &mut Formatter<'_>) -> Result

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> UnsafeUnpin for PanicMessage<'a>

impl<'a> UnwindSafe for PanicMessage<'a>

impl<T> Any for PanicMessage<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for PanicMessage<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for PanicMessage<'a>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for PanicMessage<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for PanicMessage<'a>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for PanicMessage<'a>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for PanicMessage<'a>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>