pub struct PanicVal<'a> { /* private fields */ }Expand description
An opaque enum of the values that this crate knows how to format, along with some formatting metadata.
This has constructor functions to make a PanicVal from:
bool- Integers
&str- Arrays/Slices of primitives (with the “non_basic” feature, enabled by default)
ShortString(with the “non_basic” feature, enabled by default)
Implementations§
Source§impl<'a> PanicVal<'a>
impl<'a> PanicVal<'a>
Sourcepub const fn from_short_str(this: ShortString, f: FmtArg) -> PanicVal<'a>
pub const fn from_short_str(this: ShortString, f: FmtArg) -> PanicVal<'a>
Constructs a PanicVal from a ShortString.
Source§impl<'a> PanicVal<'a>
impl<'a> PanicVal<'a>
Sourcepub const fn with_leftpad(self, fmtarg: FmtArg) -> Self
pub const fn with_leftpad(self, fmtarg: FmtArg) -> Self
Sets the amount of spaces printed before this to fmtarg.indentation.
Note that only strings can be padded.
Sourcepub const fn with_rightpad(self, fmtarg: FmtArg) -> Self
pub const fn with_rightpad(self, fmtarg: FmtArg) -> Self
Sets the amount of spaces printed after this to fmtarg.indentation.
Note that only strings can be padded.
Sourcepub const fn write_str(string: &'a str) -> Self
pub const fn write_str(string: &'a str) -> Self
Constructs a PanicVal which outputs the contents of string verbatim.
Equivalent to PanicVal::from_str(string, FmtArg::DISPLAY)
Sourcepub const fn write_short_str(string: ShortString) -> Self
pub const fn write_short_str(string: ShortString) -> Self
Constructs a PanicVal from a ShortString, which outputs the string verbatim.
Sourcepub const fn from_element_separator(
separator: &str,
is_last_field: IsLast,
fmtarg: FmtArg,
) -> Self
pub const fn from_element_separator( separator: &str, is_last_field: IsLast, fmtarg: FmtArg, ) -> Self
Constructs a PanicVal usable as a separator between fields or elements.
This is sensitive to the fmtarg.is_alternate flag,
for more details on that you can look at the docs for
Separator::to_panicval
§Panics
This panics if string.len() is greater than 12.
Source§impl<'a> PanicVal<'a>
impl<'a> PanicVal<'a>
Sourcepub const fn to_panicvals(&self, _: FmtArg) -> [PanicVal<'a>; 1]
pub const fn to_panicvals(&self, _: FmtArg) -> [PanicVal<'a>; 1]
Wraps this PanicVal in a single-element array.
Sourcepub const fn to_panicval(&self, _: FmtArg) -> PanicVal<'a>
pub const fn to_panicval(&self, _: FmtArg) -> PanicVal<'a>
Returns a copy of this PanicVal.
Source§impl<'s> PanicVal<'s>
impl<'s> PanicVal<'s>
Sourcepub const fn from_slice_u8(this: &'s [u8], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_u8(this: &'s [u8], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_u16(this: &'s [u16], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_u16(this: &'s [u16], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_u32(this: &'s [u32], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_u32(this: &'s [u32], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_u64(this: &'s [u64], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_u64(this: &'s [u64], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_u128(this: &'s [u128], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_u128(this: &'s [u128], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_usize(this: &'s [usize], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_usize(this: &'s [usize], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_i8(this: &'s [i8], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_i8(this: &'s [i8], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_i16(this: &'s [i16], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_i16(this: &'s [i16], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_i32(this: &'s [i32], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_i32(this: &'s [i32], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_i64(this: &'s [i64], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_i64(this: &'s [i64], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_i128(this: &'s [i128], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_i128(this: &'s [i128], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_isize(this: &'s [isize], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_isize(this: &'s [isize], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_bool(this: &'s [bool], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_bool(this: &'s [bool], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_char(this: &'s [char], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_char(this: &'s [char], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Sourcepub const fn from_slice_str(this: &'s [&'s str], fmtarg: FmtArg) -> PanicVal<'s>
pub const fn from_slice_str(this: &'s [&'s str], fmtarg: FmtArg) -> PanicVal<'s>
Constructs a PanicVal from a slice.
Source§impl PanicVal<'_>
impl PanicVal<'_>
Sourcepub const fn from_usize(this: usize, f: FmtArg) -> PanicVal<'static>
pub const fn from_usize(this: usize, f: FmtArg) -> PanicVal<'static>
Constructs this PanicVal from an integer.
Source§impl PanicVal<'_>
impl PanicVal<'_>
Sourcepub const fn from_isize(this: isize, f: FmtArg) -> PanicVal<'static>
pub const fn from_isize(this: isize, f: FmtArg) -> PanicVal<'static>
Constructs this PanicVal from an integer.