Struct const_format::PWrapper

source ·
pub struct PWrapper<T>(pub T);
Available on crate feature fmt only.
Expand description

Wrapper for many std types, which implements the const_debug_fmt and/or const_display_fmt methods for them.

The macros from this crate automatically wraps std types in this type, so you only need to use it if you’re manually calling the const_*_fmt methods.

Constructors

Most std types can be wrapped in this type simply by doing PWrapper(value).

To wrap arrays, there is the PWrapper::slice constructor for convenience.

Excluded std types

Note that this type does not implement the formatting methods for std types which wrap non-std types, only for a selection of wrapped std types.

You can use the call_debug_fmt macro to format arrays/slices/Options of any type that can be const debug formatted.

Example

This example demonstrates how you can implement debug formatting for a type using PWrapper to write std types.

#![feature(const_mut_refs)]

use const_format::{Error, Formatter, PWrapper};
use const_format::{impl_fmt, formatc, try_};

use core::num::NonZeroU32;

pub struct Divide(pub u32, pub u32);

impl_fmt!{
    impl Divide;
     
    pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
        let Self(left, right) = *self;
        let divided = self.0 / self.1;

        let mut f = f.debug_struct("Divide");
        try_!(PWrapper(self.0).const_debug_fmt(f.field("numerator")));
        try_!(PWrapper(self.1).const_debug_fmt(f.field("denominator")));
        try_!(PWrapper(divided).const_debug_fmt(f.field("divided")));
        f.finish()
    }
}

const TEXT: &str = formatc!("{:?}", Divide(34, 11));
const T_HEX: &str = formatc!("{:X?}", Divide(34, 11));
const T_BIN: &str = formatc!("{:b?}", Divide(34, 11));

assert_eq!(TEXT, "Divide { numerator: 34, denominator: 11, divided: 3 }");
assert_eq!(T_HEX, "Divide { numerator: 22, denominator: B, divided: 3 }");
assert_eq!(T_BIN, "Divide { numerator: 100010, denominator: 1011, divided: 11 }");

Tuple Fields§

§0: T

Implementations§

source§

impl PWrapper<&[&str]>

source

pub const fn const_eq(&self, other: &[&str]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[bool]>

source

pub const fn const_eq(&self, other: &[bool]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[char]>

source

pub const fn const_eq(&self, other: &[char]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[u8]>

source

pub const fn const_eq(&self, other: &[u8]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[i8]>

source

pub const fn const_eq(&self, other: &[i8]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[u16]>

source

pub const fn const_eq(&self, other: &[u16]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[i16]>

source

pub const fn const_eq(&self, other: &[i16]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[u32]>

source

pub const fn const_eq(&self, other: &[u32]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[i32]>

source

pub const fn const_eq(&self, other: &[i32]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[u64]>

source

pub const fn const_eq(&self, other: &[u64]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[i64]>

source

pub const fn const_eq(&self, other: &[i64]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[u128]>

source

pub const fn const_eq(&self, other: &[u128]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[i128]>

source

pub const fn const_eq(&self, other: &[i128]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[usize]>

source

pub const fn const_eq(&self, other: &[usize]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&[isize]>

source

pub const fn const_eq(&self, other: &[isize]) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<u8>>

source

pub const fn const_eq(&self, other: &Option<u8>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<i8>>

source

pub const fn const_eq(&self, other: &Option<i8>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<u16>>

source

pub const fn const_eq(&self, other: &Option<u16>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<i16>>

source

pub const fn const_eq(&self, other: &Option<i16>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<u32>>

source

pub const fn const_eq(&self, other: &Option<u32>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<i32>>

source

pub const fn const_eq(&self, other: &Option<i32>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<u64>>

source

pub const fn const_eq(&self, other: &Option<u64>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<i64>>

source

pub const fn const_eq(&self, other: &Option<i64>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<u128>>

source

pub const fn const_eq(&self, other: &Option<u128>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<i128>>

source

pub const fn const_eq(&self, other: &Option<i128>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<usize>>

source

pub const fn const_eq(&self, other: &Option<usize>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<isize>>

source

pub const fn const_eq(&self, other: &Option<isize>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<bool>>

source

pub const fn const_eq(&self, other: &Option<bool>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<char>>

source

pub const fn const_eq(&self, other: &Option<char>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<&str>>

source

pub const fn const_eq(&self, other: &Option<&str>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroU8>

source

pub const fn const_eq(&self, r: &NonZeroU8) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroI8>

source

pub const fn const_eq(&self, r: &NonZeroI8) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroU16>

source

pub const fn const_eq(&self, r: &NonZeroU16) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroI16>

source

pub const fn const_eq(&self, r: &NonZeroI16) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroU32>

source

pub const fn const_eq(&self, r: &NonZeroU32) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroI32>

source

pub const fn const_eq(&self, r: &NonZeroI32) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroU64>

source

pub const fn const_eq(&self, r: &NonZeroU64) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroI64>

source

pub const fn const_eq(&self, r: &NonZeroI64) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroU128>

source

pub const fn const_eq(&self, r: &NonZeroU128) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroI128>

source

pub const fn const_eq(&self, r: &NonZeroI128) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroUsize>

source

pub const fn const_eq(&self, r: &NonZeroUsize) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<NonZeroIsize>

source

pub const fn const_eq(&self, r: &NonZeroIsize) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroU8>>

source

pub const fn const_eq(&self, other: &Option<NonZeroU8>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroI8>>

source

pub const fn const_eq(&self, other: &Option<NonZeroI8>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroU16>>

source

pub const fn const_eq(&self, other: &Option<NonZeroU16>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroI16>>

source

pub const fn const_eq(&self, other: &Option<NonZeroI16>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroU32>>

source

pub const fn const_eq(&self, other: &Option<NonZeroU32>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroI32>>

source

pub const fn const_eq(&self, other: &Option<NonZeroI32>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroU64>>

source

pub const fn const_eq(&self, other: &Option<NonZeroU64>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroI64>>

source

pub const fn const_eq(&self, other: &Option<NonZeroI64>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroU128>>

source

pub const fn const_eq(&self, other: &Option<NonZeroU128>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroI128>>

source

pub const fn const_eq(&self, other: &Option<NonZeroI128>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroUsize>>

source

pub const fn const_eq(&self, other: &Option<NonZeroUsize>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Option<NonZeroIsize>>

source

pub const fn const_eq(&self, other: &Option<NonZeroIsize>) -> bool

This method is only available with the “assert” feature.

source§

impl<T: ?Sized> PWrapper<PhantomData<T>>

source

pub const fn const_eq(&self, r: &PhantomData<T>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<PhantomPinned>

source

pub const fn const_eq(&self, r: &PhantomPinned) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<()>

source

pub const fn const_eq(&self, r: &()) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Ordering>

source

pub const fn const_eq(&self, r: &Ordering) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<AtomicOrdering>

source

pub const fn const_eq(&self, r: &AtomicOrdering) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Range<usize>>

source

pub const fn const_eq(&self, r: &Range<usize>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<RangeInclusive<usize>>

source

pub const fn const_eq(&self, r: &RangeInclusive<usize>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<RangeFrom<usize>>

source

pub const fn const_eq(&self, r: &RangeFrom<usize>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<RangeFull>

source

pub const fn const_eq(&self, r: &RangeFull) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<RangeTo<usize>>

source

pub const fn const_eq(&self, r: &RangeTo<usize>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<RangeToInclusive<usize>>

source

pub const fn const_eq(&self, r: &RangeToInclusive<usize>) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<Range<usize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<RangeFrom<usize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<RangeTo<usize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<RangeToInclusive<usize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<RangeInclusive<usize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<RangeFull>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&str>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<bool>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<char>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[&str]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[bool]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[char]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[u8]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[i8]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[u16]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[i16]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[u32]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[i32]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[u64]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[i64]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[u128]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[i128]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[usize]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<&[isize]>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl<T> PWrapper<Option<NonNull<T>>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroU8>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroI8>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroU16>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroI16>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroU32>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroI32>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroU64>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroI64>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroU128>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroI128>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroUsize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<NonZeroIsize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<u8>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<i8>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<u16>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<i16>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<u32>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<i32>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<u64>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<i64>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<u128>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<i128>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<usize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<isize>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<bool>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Option<char>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl<'a> PWrapper<Option<&'a str>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<NonZeroU8>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroI8>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroU16>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroI16>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroU32>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroI32>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroU64>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroI64>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroU128>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroI128>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroUsize>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl PWrapper<NonZeroIsize>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

source§

impl<T> PWrapper<*mut T>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl<T> PWrapper<*const T>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl<T> PWrapper<NonNull<T>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl<T: ?Sized> PWrapper<PhantomData<T>>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<PhantomPinned>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<()>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<AtomicOrdering>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<Ordering>

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

source§

impl PWrapper<u8>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a u8 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a u8 with Debug formatting.

source§

impl PWrapper<u16>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a u16 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a u16 with Debug formatting.

source§

impl PWrapper<u32>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a u32 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a u32 with Debug formatting.

source§

impl PWrapper<u64>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a u64 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a u64 with Debug formatting.

source§

impl PWrapper<u128>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a u128 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a u128 with Debug formatting.

source§

impl PWrapper<usize>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a usize with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a usize with Debug formatting.

source§

impl PWrapper<i8>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a i8 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a i8 with Debug formatting.

source§

impl PWrapper<i16>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a i16 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a i16 with Debug formatting.

source§

impl PWrapper<i32>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a i32 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a i32 with Debug formatting.

source§

impl PWrapper<i64>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a i64 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a i64 with Debug formatting.

source§

impl PWrapper<i128>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a i128 with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a i128 with Debug formatting.

source§

impl PWrapper<isize>

source

pub const fn const_display_fmt( &self, f: &mut Formatter<'_> ) -> Result<(), Error>

Writes a isize with Display formatting.

source

pub const fn const_debug_fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Writes a isize with Debug formatting.

source§

impl<'a, T> PWrapper<&'a [T]>

source

pub const fn slice(x: &'a [T]) -> Self

For constructing from a reference to an array.

With slices you can do PWrapper(slice) as well.

source§

impl PWrapper<i8>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<i8>

source

pub const fn unsigned_abs(self) -> u8

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<i16>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<i16>

source

pub const fn unsigned_abs(self) -> u16

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<i32>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<i32>

source

pub const fn unsigned_abs(self) -> u32

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<i64>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<i64>

source

pub const fn unsigned_abs(self) -> u64

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<i128>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<i128>

source

pub const fn unsigned_abs(self) -> u128

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<u8>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<u8>

source

pub const fn unsigned_abs(self) -> u8

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<u16>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<u16>

source

pub const fn unsigned_abs(self) -> u16

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<u32>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<u32>

source

pub const fn unsigned_abs(self) -> u32

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<u64>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<u64>

source

pub const fn unsigned_abs(self) -> u64

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<u128>

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<u128>

source

pub const fn unsigned_abs(self) -> u128

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<usize>

source

pub const fn compute_display_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a literal.

source

pub const fn compute_debug_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a literal.

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<isize>

source

pub const fn compute_display_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a literal.

source

pub const fn compute_debug_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a literal.

source

pub const fn hexadecimal_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a hexadecimal literal.

source

pub const fn binary_len(self, fmt: FormattingFlags) -> usize

Computes how long much space is necessary to write this integer as a binary literal.

source§

impl PWrapper<usize>

source

pub const fn unsigned_abs(self) -> usize

Returns the absolute value of this integer.

source§

impl PWrapper<isize>

source

pub const fn unsigned_abs(self) -> usize

Returns the absolute value of this integer, as the equivalent unsigned type.

source§

impl PWrapper<&[u8]>

source

pub const fn compute_utf8_debug_len(self) -> usize

Computes how much space is necessary to write the wrapped &[u8] as a utf8 string, with debug formatting

source

pub const fn compute_utf8_debug_len_in_range(self, range: Range<usize>) -> usize

Computes how much space is necessary to write &self.0[range] as a utf8 string, with debug formatting

source§

impl PWrapper<u8>

source

pub const fn const_eq(&self, r: &u8) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<i8>

source

pub const fn const_eq(&self, r: &i8) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<u16>

source

pub const fn const_eq(&self, r: &u16) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<i16>

source

pub const fn const_eq(&self, r: &i16) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<u32>

source

pub const fn const_eq(&self, r: &u32) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<i32>

source

pub const fn const_eq(&self, r: &i32) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<u64>

source

pub const fn const_eq(&self, r: &u64) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<i64>

source

pub const fn const_eq(&self, r: &i64) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<u128>

source

pub const fn const_eq(&self, r: &u128) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<i128>

source

pub const fn const_eq(&self, r: &i128) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<usize>

source

pub const fn const_eq(&self, r: &usize) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<isize>

source

pub const fn const_eq(&self, r: &isize) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<bool>

source

pub const fn const_eq(&self, r: &bool) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<char>

source

pub const fn const_eq(&self, r: &char) -> bool

This method is only available with the “assert” feature.

source§

impl PWrapper<&str>

source

pub const fn const_eq(&self, r: &&str) -> bool

This method is only available with the “assert” feature.

Trait Implementations§

source§

impl<T: Clone> Clone for PWrapper<T>

source§

fn clone(&self) -> PWrapper<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<P> FormatMarker for PWrapper<P>

§

type Kind = IsNotStdKind

What kind of type this is, this can be one of: Read more
§

type This = PWrapper<P>

The type after dereferencing, implemented as type This = Self; for all non-reference types
source§

impl<T: Copy> Copy for PWrapper<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for PWrapper<T>where T: RefUnwindSafe,

§

impl<T> Send for PWrapper<T>where T: Send,

§

impl<T> Sync for PWrapper<T>where T: Sync,

§

impl<T> Unpin for PWrapper<T>where T: Unpin,

§

impl<T> UnwindSafe for PWrapper<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.