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§
source§impl StdWrapper<&char>
impl StdWrapper<&char>
sourcepub const fn to_panicvals(self, fmtarg: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, fmtarg: FmtArg) -> [PanicVal<'static>; 1]
Converts this char
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, fmtarg: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, fmtarg: FmtArg) -> PanicVal<'static>
Converts this char
to a PanicVal
.
source§impl StdWrapper<&u8>
impl StdWrapper<&u8>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this u8
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this u8
to a PanicVal
.
source§impl StdWrapper<&u16>
impl StdWrapper<&u16>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this u16
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this u16
to a PanicVal
.
source§impl StdWrapper<&u32>
impl StdWrapper<&u32>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this u32
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this u32
to a PanicVal
.
source§impl StdWrapper<&u64>
impl StdWrapper<&u64>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this u64
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this u64
to a PanicVal
.
source§impl StdWrapper<&u128>
impl StdWrapper<&u128>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this u128
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this u128
to a PanicVal
.
source§impl StdWrapper<&usize>
impl StdWrapper<&usize>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this usize
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this usize
to a PanicVal
.
source§impl StdWrapper<&i8>
impl StdWrapper<&i8>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this i8
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this i8
to a PanicVal
.
source§impl StdWrapper<&i16>
impl StdWrapper<&i16>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this i16
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this i16
to a PanicVal
.
source§impl StdWrapper<&i32>
impl StdWrapper<&i32>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this i32
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this i32
to a PanicVal
.
source§impl StdWrapper<&i64>
impl StdWrapper<&i64>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this i64
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this i64
to a PanicVal
.
source§impl StdWrapper<&i128>
impl StdWrapper<&i128>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this i128
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this i128
to a PanicVal
.
source§impl StdWrapper<&isize>
impl StdWrapper<&isize>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Converts this isize
to a single-element PanicVal
array.
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Converts this isize
to a PanicVal
.
source§impl<'s> StdWrapper<&'s bool>
impl<'s> StdWrapper<&'s bool>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'static>; 1]
Formats this bool
into a single-PanicVal
array
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'static>
Formats this bool
into a PanicVal
source§impl<'a> StdWrapper<&'a str>
impl<'a> StdWrapper<&'a str>
sourcepub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'a>; 1]
pub const fn to_panicvals(self, f: FmtArg) -> [PanicVal<'a>; 1]
Formats this &str
into a single-PanicVal
array
sourcepub const fn to_panicval(self, f: FmtArg) -> PanicVal<'a>
pub const fn to_panicval(self, f: FmtArg) -> PanicVal<'a>
Formats this &str
into a PanicVal
source§impl<'s, 'a, const N: usize> StdWrapper<&'s [PanicVal<'a>; N]>
impl<'s, 'a, const N: usize> StdWrapper<&'s [PanicVal<'a>; N]>
sourcepub const fn to_panicvals(self, _: FmtArg) -> &'s [PanicVal<'a>; N]
pub const fn to_panicvals(self, _: FmtArg) -> &'s [PanicVal<'a>; N]
source§impl<'s, 'a> StdWrapper<&'s [PanicVal<'a>]>
impl<'s, 'a> StdWrapper<&'s [PanicVal<'a>]>
sourcepub const fn to_panicvals(self, _: FmtArg) -> &'s [PanicVal<'a>]
pub const fn to_panicvals(self, _: FmtArg) -> &'s [PanicVal<'a>]
source§impl<'a, 'b> StdWrapper<&'a &'b [PanicVal<'b>]>
impl<'a, 'b> StdWrapper<&'a &'b [PanicVal<'b>]>
sourcepub const fn deref_panic_vals(self) -> &'b [PanicVal<'b>]
pub const fn deref_panic_vals(self) -> &'b [PanicVal<'b>]
Coerces a &&[PanicVal<'_>]
into a &[PanicVal<'_>]
source§impl<'a, 'b, const N: usize> StdWrapper<&'a &'b [PanicVal<'b>; N]>
impl<'a, 'b, const N: usize> StdWrapper<&'a &'b [PanicVal<'b>; N]>
sourcepub const fn deref_panic_vals(self) -> &'b [PanicVal<'b>]
pub const fn deref_panic_vals(self) -> &'b [PanicVal<'b>]
Coerces a &&[PanicVal<'_>; N]
into a &[PanicVal<'_>]
source§impl<'b, const N: usize> StdWrapper<&'b [PanicVal<'b>; N]>
impl<'b, const N: usize> StdWrapper<&'b [PanicVal<'b>; N]>
sourcepub const fn deref_panic_vals(self) -> &'b [PanicVal<'b>]
pub const fn deref_panic_vals(self) -> &'b [PanicVal<'b>]
Coerces a &[PanicVal<'_>; N]
into a &[PanicVal<'_>]
source§impl StdWrapper<&Utf8Error>
impl StdWrapper<&Utf8Error>
sourcepub const fn to_panicvals(self, fmtarg: FmtArg) -> [PanicVal<'static>; 5]
pub const fn to_panicvals(self, fmtarg: FmtArg) -> [PanicVal<'static>; 5]
Formats a Utf8Error
(supports both Debug and Display formatting).
Trait Implementations§
source§impl<T: Clone> Clone for StdWrapper<T>
impl<T: Clone> Clone for StdWrapper<T>
source§fn clone(&self) -> StdWrapper<T>
fn clone(&self) -> StdWrapper<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T> PanicFmt for StdWrapper<T>where
T: PanicFmt,
impl<T> PanicFmt for StdWrapper<T>where
T: PanicFmt,
§type This = StdWrapper<T>
type This = StdWrapper<T>
§type Kind = IsCustomType
type Kind = IsCustomType
impl<T: Copy> Copy for StdWrapper<T>
Auto Trait Implementations§
impl<T> Freeze for StdWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for StdWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for StdWrapper<T>where
T: Send,
impl<T> Sync for StdWrapper<T>where
T: Sync,
impl<T> Unpin for StdWrapper<T>where
T: Unpin,
impl<T> UnwindSafe for StdWrapper<T>where
T: UnwindSafe,
Blanket Implementations§
source§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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)