pub struct IsAFormatMarker<K, T: ?Sized, R: ?Sized>(_);
Available on crate feature fmt only.
Expand description

Hack used to automatically wrap standard library types inside PWrapper, while leaving user defined types unwrapped.

Type parameters

K is <R as FormatMarker>::Kind The kind of type that T is, a slice, other std types, non-std types.

T is <R as FormatMarker>::This: The R type after removing all layers of references.

R: a type that implements FormatMarker.

Coerce Method

The coerce method is what does the conversion from a &T depending on the K type parameter:

Implementations§

source§

impl<R> IsAFormatMarker<R::Kind, R::This, R>where R: ?Sized + FormatMarker,

source

pub const NEW: Self = _

Constructs an IsAFormatMarker

source§

impl<K, T: ?Sized, R: ?Sized> IsAFormatMarker<K, T, R>

source

pub const fn infer_type(self, _: &R) -> Self

Infers the type parameters by taking a reference to R .

The K and T type parameters are determined by R in the NEW associated constant.

source

pub const fn unreference(self, r: &T) -> &T

Removes layers of references by coercing the argument.

source§

impl<U, T: ?Sized, R: ?Sized> IsAFormatMarker<IsArrayKind<U>, T, R>

source

pub const fn coerce(self, slice: &[U]) -> PWrapper<&[U]>

Coerces an array to a slice, then wraps the slice in a PWrapper

source§

impl<T: ?Sized, R: ?Sized> IsAFormatMarker<IsNotStdKind, T, R>

source

pub const fn coerce(self, reference: &T) -> &T

An identity function, just takes reference and returns it.

source§

impl<T> IsAFormatMarker<IsStdKind, i8, T>

source

pub const fn coerce(self, reference: &i8) -> PWrapper<i8>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, u8, T>

source

pub const fn coerce(self, reference: &u8) -> PWrapper<u8>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, i16, T>

source

pub const fn coerce(self, reference: &i16) -> PWrapper<i16>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, u16, T>

source

pub const fn coerce(self, reference: &u16) -> PWrapper<u16>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, i32, T>

source

pub const fn coerce(self, reference: &i32) -> PWrapper<i32>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, u32, T>

source

pub const fn coerce(self, reference: &u32) -> PWrapper<u32>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, i64, T>

source

pub const fn coerce(self, reference: &i64) -> PWrapper<i64>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, u64, T>

source

pub const fn coerce(self, reference: &u64) -> PWrapper<u64>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, i128, T>

source

pub const fn coerce(self, reference: &i128) -> PWrapper<i128>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, u128, T>

source

pub const fn coerce(self, reference: &u128) -> PWrapper<u128>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, isize, T>

source

pub const fn coerce(self, reference: &isize) -> PWrapper<isize>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, usize, T>

source

pub const fn coerce(self, reference: &usize) -> PWrapper<usize>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, bool, T>

source

pub const fn coerce(self, reference: &bool) -> PWrapper<bool>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<T> IsAFormatMarker<IsStdKind, char, T>

source

pub const fn coerce(self, reference: &char) -> PWrapper<char>

Copies the value from reference, and wraps it in a PWrapper

source§

impl<R: ?Sized> IsAFormatMarker<IsStdKind, str, R>

source

pub const fn coerce(self, reference: &str) -> PWrapper<&str>

Wraps reference in a PWrapper.

source§

impl<T> IsAFormatMarker<IsStdKind, Range<usize>, T>

source

pub const fn coerce(self, range: &Range<usize>) -> PWrapper<Range<usize>>

source§

impl<T> IsAFormatMarker<IsStdKind, RangeFrom<usize>, T>

source

pub const fn coerce( self, range: &RangeFrom<usize> ) -> PWrapper<RangeFrom<usize>>

source§

impl<T> IsAFormatMarker<IsStdKind, RangeTo<usize>, T>

source

pub const fn coerce(self, range: &RangeTo<usize>) -> PWrapper<RangeTo<usize>>

source§

impl<T> IsAFormatMarker<IsStdKind, RangeToInclusive<usize>, T>

source§

impl<T> IsAFormatMarker<IsStdKind, RangeInclusive<usize>, T>

source

pub const fn coerce( self, range: &RangeInclusive<usize> ) -> PWrapper<RangeInclusive<usize>>

source§

impl<T> IsAFormatMarker<IsStdKind, RangeFull, T>

source

pub const fn coerce(self, _: &RangeFull) -> PWrapper<RangeFull>

source§

impl<T, __T> IsAFormatMarker<IsStdKind, Option<NonNull<T>>, __T>

source

pub const fn coerce( self, reference: &Option<NonNull<T>> ) -> PWrapper<Option<NonNull<T>>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU8>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroU8> ) -> PWrapper<Option<NonZeroU8>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI8>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroI8> ) -> PWrapper<Option<NonZeroI8>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU16>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroU16> ) -> PWrapper<Option<NonZeroU16>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI16>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroI16> ) -> PWrapper<Option<NonZeroI16>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU32>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroU32> ) -> PWrapper<Option<NonZeroU32>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI32>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroI32> ) -> PWrapper<Option<NonZeroI32>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU64>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroU64> ) -> PWrapper<Option<NonZeroU64>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI64>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroI64> ) -> PWrapper<Option<NonZeroI64>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU128>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroU128> ) -> PWrapper<Option<NonZeroU128>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI128>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroI128> ) -> PWrapper<Option<NonZeroI128>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroUsize>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroUsize> ) -> PWrapper<Option<NonZeroUsize>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroIsize>, __T>

source

pub const fn coerce( self, reference: &Option<NonZeroIsize> ) -> PWrapper<Option<NonZeroIsize>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<u8>, __T>

source

pub const fn coerce(self, reference: &Option<u8>) -> PWrapper<Option<u8>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<i8>, __T>

source

pub const fn coerce(self, reference: &Option<i8>) -> PWrapper<Option<i8>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<u16>, __T>

source

pub const fn coerce(self, reference: &Option<u16>) -> PWrapper<Option<u16>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<i16>, __T>

source

pub const fn coerce(self, reference: &Option<i16>) -> PWrapper<Option<i16>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<u32>, __T>

source

pub const fn coerce(self, reference: &Option<u32>) -> PWrapper<Option<u32>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<i32>, __T>

source

pub const fn coerce(self, reference: &Option<i32>) -> PWrapper<Option<i32>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<u64>, __T>

source

pub const fn coerce(self, reference: &Option<u64>) -> PWrapper<Option<u64>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<i64>, __T>

source

pub const fn coerce(self, reference: &Option<i64>) -> PWrapper<Option<i64>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<u128>, __T>

source

pub const fn coerce(self, reference: &Option<u128>) -> PWrapper<Option<u128>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<i128>, __T>

source

pub const fn coerce(self, reference: &Option<i128>) -> PWrapper<Option<i128>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<usize>, __T>

source

pub const fn coerce(self, reference: &Option<usize>) -> PWrapper<Option<usize>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<isize>, __T>

source

pub const fn coerce(self, reference: &Option<isize>) -> PWrapper<Option<isize>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<bool>, __T>

source

pub const fn coerce(self, reference: &Option<bool>) -> PWrapper<Option<bool>>

source§

impl<__T> IsAFormatMarker<IsStdKind, Option<char>, __T>

source

pub const fn coerce(self, reference: &Option<char>) -> PWrapper<Option<char>>

source§

impl<'a, __T> IsAFormatMarker<IsStdKind, Option<&'a str>, __T>

source

pub const fn coerce( self, reference: &Option<&'a str> ) -> PWrapper<Option<&'a str>>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroU8, __T>

source

pub const fn coerce(self, reference: &NonZeroU8) -> PWrapper<NonZeroU8>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroI8, __T>

source

pub const fn coerce(self, reference: &NonZeroI8) -> PWrapper<NonZeroI8>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroU16, __T>

source

pub const fn coerce(self, reference: &NonZeroU16) -> PWrapper<NonZeroU16>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroI16, __T>

source

pub const fn coerce(self, reference: &NonZeroI16) -> PWrapper<NonZeroI16>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroU32, __T>

source

pub const fn coerce(self, reference: &NonZeroU32) -> PWrapper<NonZeroU32>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroI32, __T>

source

pub const fn coerce(self, reference: &NonZeroI32) -> PWrapper<NonZeroI32>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroU64, __T>

source

pub const fn coerce(self, reference: &NonZeroU64) -> PWrapper<NonZeroU64>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroI64, __T>

source

pub const fn coerce(self, reference: &NonZeroI64) -> PWrapper<NonZeroI64>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroU128, __T>

source

pub const fn coerce(self, reference: &NonZeroU128) -> PWrapper<NonZeroU128>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroI128, __T>

source

pub const fn coerce(self, reference: &NonZeroI128) -> PWrapper<NonZeroI128>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroUsize, __T>

source

pub const fn coerce(self, reference: &NonZeroUsize) -> PWrapper<NonZeroUsize>

source§

impl<__T> IsAFormatMarker<IsStdKind, NonZeroIsize, __T>

source

pub const fn coerce(self, reference: &NonZeroIsize) -> PWrapper<NonZeroIsize>

source§

impl<T, __T> IsAFormatMarker<IsStdKind, *mut T, __T>

source

pub const fn coerce(self, reference: &*mut T) -> PWrapper<*mut T>

source§

impl<T, __T> IsAFormatMarker<IsStdKind, *const T, __T>

source

pub const fn coerce(self, reference: &*const T) -> PWrapper<*const T>

source§

impl<T, __T> IsAFormatMarker<IsStdKind, NonNull<T>, __T>

source

pub const fn coerce(self, reference: &NonNull<T>) -> PWrapper<NonNull<T>>

source§

impl<T: ?Sized, __T> IsAFormatMarker<IsStdKind, PhantomData<T>, __T>

source

pub const fn coerce( self, reference: &PhantomData<T> ) -> PWrapper<PhantomData<T>>

source§

impl<__T> IsAFormatMarker<IsStdKind, PhantomPinned, __T>

source

pub const fn coerce(self, reference: &PhantomPinned) -> PWrapper<PhantomPinned>

source§

impl<__T> IsAFormatMarker<IsStdKind, (), __T>

source

pub const fn coerce(self, reference: &()) -> PWrapper<()>

source§

impl<__T> IsAFormatMarker<IsStdKind, AtomicOrdering, __T>

source

pub const fn coerce( self, reference: &AtomicOrdering ) -> PWrapper<AtomicOrdering>

source§

impl<__T> IsAFormatMarker<IsStdKind, Ordering, __T>

source

pub const fn coerce(self, reference: &Ordering) -> PWrapper<Ordering>

Trait Implementations§

source§

impl<K, T: ?Sized, R: ?Sized> Clone for IsAFormatMarker<K, T, R>

source§

fn clone(&self) -> Self

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<K, T: ?Sized, R: ?Sized> Copy for IsAFormatMarker<K, T, R>

Auto Trait Implementations§

§

impl<K, T: ?Sized, R: ?Sized> RefUnwindSafe for IsAFormatMarker<K, T, R>

§

impl<K, T: ?Sized, R: ?Sized> Send for IsAFormatMarker<K, T, R>

§

impl<K, T: ?Sized, R: ?Sized> Sync for IsAFormatMarker<K, T, R>

§

impl<K, T: ?Sized, R: ?Sized> Unpin for IsAFormatMarker<K, T, R>

§

impl<K, T: ?Sized, R: ?Sized> UnwindSafe for IsAFormatMarker<K, T, R>

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.