pub struct IsAFormatMarker<K, T: ?Sized, R: ?Sized>(/* private fields */);
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:
-
IsArrayKind
: the reference is coerced to a slice, and wrapped in aPWrapper
. -
IsStdKind
: the referenced value is copied, and wrapped in aPWrapper
. -
IsNotStdKind
: the reference is simply returned as a&T
.
Implementations§
Source§impl<R> IsAFormatMarker<R::Kind, R::This, R>where
R: ?Sized + FormatMarker,
impl<R> IsAFormatMarker<R::Kind, R::This, R>where
R: ?Sized + FormatMarker,
Source§impl<K, T: ?Sized, R: ?Sized> IsAFormatMarker<K, T, R>
impl<K, T: ?Sized, R: ?Sized> IsAFormatMarker<K, T, R>
Sourcepub const fn infer_type(self, _: &R) -> Self
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.
Sourcepub const fn unreference(self, r: &T) -> &T
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>
impl<U, T: ?Sized, R: ?Sized> IsAFormatMarker<IsArrayKind<U>, T, R>
Source§impl<T: ?Sized, R: ?Sized> IsAFormatMarker<IsNotStdKind, T, R>
impl<T: ?Sized, R: ?Sized> IsAFormatMarker<IsNotStdKind, T, R>
Source§impl<T> IsAFormatMarker<IsStdKind, i8, T>
impl<T> IsAFormatMarker<IsStdKind, i8, T>
Source§impl<T> IsAFormatMarker<IsStdKind, u8, T>
impl<T> IsAFormatMarker<IsStdKind, u8, T>
Source§impl<T> IsAFormatMarker<IsStdKind, i16, T>
impl<T> IsAFormatMarker<IsStdKind, i16, T>
Source§impl<T> IsAFormatMarker<IsStdKind, u16, T>
impl<T> IsAFormatMarker<IsStdKind, u16, T>
Source§impl<T> IsAFormatMarker<IsStdKind, i32, T>
impl<T> IsAFormatMarker<IsStdKind, i32, T>
Source§impl<T> IsAFormatMarker<IsStdKind, u32, T>
impl<T> IsAFormatMarker<IsStdKind, u32, T>
Source§impl<T> IsAFormatMarker<IsStdKind, i64, T>
impl<T> IsAFormatMarker<IsStdKind, i64, T>
Source§impl<T> IsAFormatMarker<IsStdKind, u64, T>
impl<T> IsAFormatMarker<IsStdKind, u64, T>
Source§impl<T> IsAFormatMarker<IsStdKind, i128, T>
impl<T> IsAFormatMarker<IsStdKind, i128, T>
Source§impl<T> IsAFormatMarker<IsStdKind, u128, T>
impl<T> IsAFormatMarker<IsStdKind, u128, T>
Source§impl<T> IsAFormatMarker<IsStdKind, isize, T>
impl<T> IsAFormatMarker<IsStdKind, isize, T>
Source§impl<T> IsAFormatMarker<IsStdKind, usize, T>
impl<T> IsAFormatMarker<IsStdKind, usize, T>
Source§impl<T> IsAFormatMarker<IsStdKind, bool, T>
impl<T> IsAFormatMarker<IsStdKind, bool, T>
Source§impl<T> IsAFormatMarker<IsStdKind, char, T>
impl<T> IsAFormatMarker<IsStdKind, char, T>
Source§impl<T> IsAFormatMarker<IsStdKind, RangeToInclusive<usize>, T>
impl<T> IsAFormatMarker<IsStdKind, RangeToInclusive<usize>, T>
pub const fn coerce( self, range: &RangeToInclusive<usize>, ) -> PWrapper<RangeToInclusive<usize>>
Source§impl<T> IsAFormatMarker<IsStdKind, RangeInclusive<usize>, T>
impl<T> IsAFormatMarker<IsStdKind, RangeInclusive<usize>, T>
pub const fn coerce( self, range: &RangeInclusive<usize>, ) -> PWrapper<RangeInclusive<usize>>
Source§impl<T> IsAFormatMarker<IsStdKind, RangeFull, T>
impl<T> IsAFormatMarker<IsStdKind, RangeFull, T>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU16>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU16>, __T>
pub const fn coerce( self, reference: &Option<NonZeroU16>, ) -> PWrapper<Option<NonZeroU16>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI16>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI16>, __T>
pub const fn coerce( self, reference: &Option<NonZeroI16>, ) -> PWrapper<Option<NonZeroI16>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU32>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU32>, __T>
pub const fn coerce( self, reference: &Option<NonZeroU32>, ) -> PWrapper<Option<NonZeroU32>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI32>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI32>, __T>
pub const fn coerce( self, reference: &Option<NonZeroI32>, ) -> PWrapper<Option<NonZeroI32>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU64>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU64>, __T>
pub const fn coerce( self, reference: &Option<NonZeroU64>, ) -> PWrapper<Option<NonZeroU64>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI64>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI64>, __T>
pub const fn coerce( self, reference: &Option<NonZeroI64>, ) -> PWrapper<Option<NonZeroI64>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU128>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU128>, __T>
pub const fn coerce( self, reference: &Option<NonZeroU128>, ) -> PWrapper<Option<NonZeroU128>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI128>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI128>, __T>
pub const fn coerce( self, reference: &Option<NonZeroI128>, ) -> PWrapper<Option<NonZeroI128>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroUsize>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroUsize>, __T>
pub const fn coerce( self, reference: &Option<NonZeroUsize>, ) -> PWrapper<Option<NonZeroUsize>>
Source§impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroIsize>, __T>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroIsize>, __T>
pub const fn coerce( self, reference: &Option<NonZeroIsize>, ) -> PWrapper<Option<NonZeroIsize>>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroU8, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU8, __T>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroI8, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI8, __T>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroU16, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU16, __T>
pub const fn coerce(self, reference: &NonZeroU16) -> PWrapper<NonZeroU16>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroI16, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI16, __T>
pub const fn coerce(self, reference: &NonZeroI16) -> PWrapper<NonZeroI16>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroU32, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU32, __T>
pub const fn coerce(self, reference: &NonZeroU32) -> PWrapper<NonZeroU32>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroI32, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI32, __T>
pub const fn coerce(self, reference: &NonZeroI32) -> PWrapper<NonZeroI32>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroU64, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU64, __T>
pub const fn coerce(self, reference: &NonZeroU64) -> PWrapper<NonZeroU64>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroI64, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI64, __T>
pub const fn coerce(self, reference: &NonZeroI64) -> PWrapper<NonZeroI64>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroU128, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU128, __T>
pub const fn coerce(self, reference: &NonZeroU128) -> PWrapper<NonZeroU128>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroI128, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI128, __T>
pub const fn coerce(self, reference: &NonZeroI128) -> PWrapper<NonZeroI128>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroUsize, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroUsize, __T>
pub const fn coerce(self, reference: &NonZeroUsize) -> PWrapper<NonZeroUsize>
Source§impl<__T> IsAFormatMarker<IsStdKind, NonZeroIsize, __T>
impl<__T> IsAFormatMarker<IsStdKind, NonZeroIsize, __T>
pub const fn coerce(self, reference: &NonZeroIsize) -> PWrapper<NonZeroIsize>
Source§impl<T, __T> IsAFormatMarker<IsStdKind, *mut T, __T>
impl<T, __T> IsAFormatMarker<IsStdKind, *mut T, __T>
Source§impl<T, __T> IsAFormatMarker<IsStdKind, *const T, __T>
impl<T, __T> IsAFormatMarker<IsStdKind, *const T, __T>
Source§impl<T, __T> IsAFormatMarker<IsStdKind, NonNull<T>, __T>
impl<T, __T> IsAFormatMarker<IsStdKind, NonNull<T>, __T>
Source§impl<T: ?Sized, __T> IsAFormatMarker<IsStdKind, PhantomData<T>, __T>
impl<T: ?Sized, __T> IsAFormatMarker<IsStdKind, PhantomData<T>, __T>
pub const fn coerce( self, reference: &PhantomData<T>, ) -> PWrapper<PhantomData<T>>
Source§impl<__T> IsAFormatMarker<IsStdKind, PhantomPinned, __T>
impl<__T> IsAFormatMarker<IsStdKind, PhantomPinned, __T>
pub const fn coerce(self, reference: &PhantomPinned) -> PWrapper<PhantomPinned>
Source§impl<__T> IsAFormatMarker<IsStdKind, (), __T>
impl<__T> IsAFormatMarker<IsStdKind, (), __T>
Source§impl<__T> IsAFormatMarker<IsStdKind, Ordering, __T>
impl<__T> IsAFormatMarker<IsStdKind, Ordering, __T>
pub const fn coerce( self, reference: &AtomicOrdering, ) -> PWrapper<AtomicOrdering>
Trait Implementations§
impl<K, T: ?Sized, R: ?Sized> Copy for IsAFormatMarker<K, T, R>
Auto Trait Implementations§
impl<K, T, R> Freeze for IsAFormatMarker<K, T, R>
impl<K, T, R> RefUnwindSafe for IsAFormatMarker<K, T, R>
impl<K, T, R> Send for IsAFormatMarker<K, T, R>
impl<K, T, R> Sync for IsAFormatMarker<K, T, R>
impl<K, T, R> Unpin for IsAFormatMarker<K, T, R>
impl<K, T, R> UnwindSafe for IsAFormatMarker<K, T, R>
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,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes