Struct const_panic::StdWrapper

source ·
#[repr(transparent)]
pub struct StdWrapper<T>(pub T);
Expand description

A wrapper type used to define methods for std types.

Std types are coerced to this type through the approach used in the coerce_fmt macro.

Example

Formatting std types with this type’s to_panicvals methods, without using macros.

use const_panic::{ArrayString, FmtArg, StdWrapper};

assert_eq!(
    ArrayString::<99>::from_panicvals(
        &StdWrapper("hello").to_panicvals(FmtArg::DEBUG)
    ).unwrap(),
    r#""hello""#
);

assert_eq!(
    ArrayString::<99>::from_panicvals(
        &StdWrapper(&[3u8, 5, 8]).to_panicvals(FmtArg::ALT_DEBUG)
    ).unwrap(),
    "[\n    3,\n    5,\n    8,\n]"
);

Tuple Fields§

§0: T

Implementations§

Converts this char to a single-element PanicVal array.

Converts this char to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Available on crate feature non_basic only.

Converts the slice to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the slice to a PanicVal.

Available on crate feature non_basic only.

Converts the array to a single-element PanicVal array.

Available on crate feature non_basic only.

Converts the array to a PanicVal.

Converts this u8 to a single-element PanicVal array.

Converts this u8 to a PanicVal.

Converts this u16 to a single-element PanicVal array.

Converts this u16 to a PanicVal.

Converts this u32 to a single-element PanicVal array.

Converts this u32 to a PanicVal.

Converts this u64 to a single-element PanicVal array.

Converts this u64 to a PanicVal.

Converts this u128 to a single-element PanicVal array.

Converts this u128 to a PanicVal.

Converts this usize to a single-element PanicVal array.

Converts this usize to a PanicVal.

Converts this i8 to a single-element PanicVal array.

Converts this i8 to a PanicVal.

Converts this i16 to a single-element PanicVal array.

Converts this i16 to a PanicVal.

Converts this i32 to a single-element PanicVal array.

Converts this i32 to a PanicVal.

Converts this i64 to a single-element PanicVal array.

Converts this i64 to a PanicVal.

Converts this i128 to a single-element PanicVal array.

Converts this i128 to a PanicVal.

Converts this isize to a single-element PanicVal array.

Converts this isize to a PanicVal.

Formats this bool into a single-PanicVal array

Formats this bool into a PanicVal

Formats this &str into a single-PanicVal array

Formats this &str into a PanicVal

Coerces a &&[PanicVal<'_>] into a &[PanicVal<'_>]

Coerces a &&[PanicVal<'_>; N] into a &[PanicVal<'_>]

Coerces a &[PanicVal<'_>; N] into a &[PanicVal<'_>]

Available on crate feature rust_1_64 only.

Formats a Utf8Error (supports both Debug and Display formatting).

Converts this Option<bool> to a PanicVal array.

Converts this Option<[bool; N]> to a PanicVal array.

Converts this Option<&'s [bool; N]> to a PanicVal array.

Converts this Option<&'s [bool]> to a PanicVal array.

Converts this Option<u8> to a PanicVal array.

Converts this Option<[u8; N]> to a PanicVal array.

Converts this Option<&'s [u8; N]> to a PanicVal array.

Converts this Option<&'s [u8]> to a PanicVal array.

Converts this Option<u16> to a PanicVal array.

Converts this Option<[u16; N]> to a PanicVal array.

Converts this Option<&'s [u16; N]> to a PanicVal array.

Converts this Option<&'s [u16]> to a PanicVal array.

Converts this Option<u32> to a PanicVal array.

Converts this Option<[u32; N]> to a PanicVal array.

Converts this Option<&'s [u32; N]> to a PanicVal array.

Converts this Option<&'s [u32]> to a PanicVal array.

Converts this Option<u64> to a PanicVal array.

Converts this Option<[u64; N]> to a PanicVal array.

Converts this Option<&'s [u64; N]> to a PanicVal array.

Converts this Option<&'s [u64]> to a PanicVal array.

Converts this Option<u128> to a PanicVal array.

Converts this Option<[u128; N]> to a PanicVal array.

Converts this Option<&'s [u128; N]> to a PanicVal array.

Converts this Option<&'s [u128]> to a PanicVal array.

Converts this Option<i8> to a PanicVal array.

Converts this Option<[i8; N]> to a PanicVal array.

Converts this Option<&'s [i8; N]> to a PanicVal array.

Converts this Option<&'s [i8]> to a PanicVal array.

Converts this Option<i16> to a PanicVal array.

Converts this Option<[i16; N]> to a PanicVal array.

Converts this Option<&'s [i16; N]> to a PanicVal array.

Converts this Option<&'s [i16]> to a PanicVal array.

Converts this Option<i32> to a PanicVal array.

Converts this Option<[i32; N]> to a PanicVal array.

Converts this Option<&'s [i32; N]> to a PanicVal array.

Converts this Option<&'s [i32]> to a PanicVal array.

Converts this Option<i64> to a PanicVal array.

Converts this Option<[i64; N]> to a PanicVal array.

Converts this Option<&'s [i64; N]> to a PanicVal array.

Converts this Option<&'s [i64]> to a PanicVal array.

Converts this Option<i128> to a PanicVal array.

Converts this Option<[i128; N]> to a PanicVal array.

Converts this Option<&'s [i128; N]> to a PanicVal array.

Converts this Option<&'s [i128]> to a PanicVal array.

Converts this Option<isize> to a PanicVal array.

Converts this Option<[isize; N]> to a PanicVal array.

Converts this Option<&'s [isize; N]> to a PanicVal array.

Converts this Option<&'s [isize]> to a PanicVal array.

Converts this Option<usize> to a PanicVal array.

Converts this Option<[usize; N]> to a PanicVal array.

Converts this Option<&'s [usize; N]> to a PanicVal array.

Converts this Option<&'s [usize]> to a PanicVal array.

Converts this Option<&'s str> to a PanicVal array.

Converts this Option<[&'s str; N]> to a PanicVal array.

Converts this Option<&'s [&'s str; N]> to a PanicVal array.

Converts this Option<&'s [&'s str]> to a PanicVal array.

Converts this NonZeroU8 to a single-element PanicVal array.

Converts this NonZeroU8 to a PanicVal.

Converts this NonZeroI8 to a single-element PanicVal array.

Converts this NonZeroI8 to a PanicVal.

Converts this NonZeroU16 to a single-element PanicVal array.

Converts this NonZeroU16 to a PanicVal.

Converts this NonZeroI16 to a single-element PanicVal array.

Converts this NonZeroI16 to a PanicVal.

Converts this NonZeroU32 to a single-element PanicVal array.

Converts this NonZeroU32 to a PanicVal.

Converts this NonZeroI32 to a single-element PanicVal array.

Converts this NonZeroI32 to a PanicVal.

Converts this NonZeroU64 to a single-element PanicVal array.

Converts this NonZeroU64 to a PanicVal.

Converts this NonZeroI64 to a single-element PanicVal array.

Converts this NonZeroI64 to a PanicVal.

Converts this NonZeroU128 to a single-element PanicVal array.

Converts this NonZeroU128 to a PanicVal.

Converts this NonZeroI128 to a single-element PanicVal array.

Converts this NonZeroI128 to a PanicVal.

Converts this NonZeroUsize to a single-element PanicVal array.

Converts this NonZeroUsize to a PanicVal.

Converts this NonZeroIsize to a single-element PanicVal array.

Converts this NonZeroIsize to a PanicVal.

Converts this Option<NonZeroU8> to a PanicVal array.

Converts this Option<NonZeroI8> to a PanicVal array.

Converts this Option<NonZeroU16> to a PanicVal array.

Converts this Option<NonZeroI16> to a PanicVal array.

Converts this Option<NonZeroU32> to a PanicVal array.

Converts this Option<NonZeroI32> to a PanicVal array.

Converts this Option<NonZeroU64> to a PanicVal array.

Converts this Option<NonZeroI64> to a PanicVal array.

Converts this Option<NonZeroU128> to a PanicVal array.

Converts this Option<NonZeroI128> to a PanicVal array.

Converts this Option<NonZeroUsize> to a PanicVal array.

Converts this Option<NonZeroIsize> to a PanicVal array.

Converts this *const T to a single-element PanicVal array.

Converts this *const T to a PanicVal.

Converts this *mut T to a single-element PanicVal array.

Converts this *mut T to a PanicVal.

Converts this NonNull<T> to a single-element PanicVal array.

Converts this NonNull<T> to a PanicVal.

Converts this Option<NonNull<T>> to a PanicVal array.

Converts this PhantomData<T> to a single-element PanicVal array.

Converts this PhantomData<T> to a PanicVal.

Converts this PhantomPinned to a single-element PanicVal array.

Converts this PhantomPinned to a PanicVal.

Converts this () to a single-element PanicVal array.

Converts this () to a PanicVal.

Converts this Option<core::cmp::Ordering> to a PanicVal array.

Converts this std::cmp::Ordering to a single-element PanicVal array.

Converts this std::cmp::Ordering to a PanicVal.

Converts this std::sync::atomic::Ordering to a single-element PanicVal array.

Converts this std::sync::atomic::Ordering to a PanicVal.

Converts this Range<usize> to a single-element PanicVal array.

Converts this RangeFrom<usize> to a single-element PanicVal array.

Converts this RangeTo<usize> to a single-element PanicVal array.

Converts this RangeToInclusive<usize> to a single-element PanicVal array.

Converts this RangeInclusive<usize> to a single-element PanicVal array.

Converts this RangeFull to a single-element PanicVal array.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
The type after dereferencing all references. Read more
Whether this is a user-defined type or standard library type. Read more
The length of the array returned in Self::to_panicvals (an inherent method that formats the type for panic messages). Read more
A marker type that proves that Self implements PanicFmt. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

A constant of the type witness

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.