[−][src]Struct const_format::marker_traits::IsAFormatMarker
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.
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
impl<R: ?Sized> IsAFormatMarker<R::Kind, R::This, R> where
R: FormatMarker,
[src]
R: FormatMarker,
impl<K, T: ?Sized, R: ?Sized> IsAFormatMarker<K, T, R>
[src]
pub const fn infer_type(self, _: &R) -> Self
[src]
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.
pub const fn unreference(self, r: &T) -> &T
[src]
Removes layers of references by coercing the argument.
impl<U, T: ?Sized, R: ?Sized> IsAFormatMarker<IsArrayKind<U>, T, R>
[src]
pub const fn coerce(self, slice: &[U]) -> PWrapper<&[U]>
[src]
Coerces an array to a slice, then wraps the slice in a PWrapper
impl<T: ?Sized, R: ?Sized> IsAFormatMarker<IsNotStdKind, T, R>
[src]
pub const fn coerce(self, reference: &T) -> &T
[src]
An identity function, just takes reference
and returns it.
impl<T> IsAFormatMarker<IsStdKind, i8, T>
[src]
pub const fn coerce(self, reference: &i8) -> PWrapper<i8>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, u8, T>
[src]
pub const fn coerce(self, reference: &u8) -> PWrapper<u8>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, i16, T>
[src]
pub const fn coerce(self, reference: &i16) -> PWrapper<i16>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, u16, T>
[src]
pub const fn coerce(self, reference: &u16) -> PWrapper<u16>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, i32, T>
[src]
pub const fn coerce(self, reference: &i32) -> PWrapper<i32>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, u32, T>
[src]
pub const fn coerce(self, reference: &u32) -> PWrapper<u32>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, i64, T>
[src]
pub const fn coerce(self, reference: &i64) -> PWrapper<i64>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, u64, T>
[src]
pub const fn coerce(self, reference: &u64) -> PWrapper<u64>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, i128, T>
[src]
pub const fn coerce(self, reference: &i128) -> PWrapper<i128>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, u128, T>
[src]
pub const fn coerce(self, reference: &u128) -> PWrapper<u128>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, isize, T>
[src]
pub const fn coerce(self, reference: &isize) -> PWrapper<isize>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, usize, T>
[src]
pub const fn coerce(self, reference: &usize) -> PWrapper<usize>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<T> IsAFormatMarker<IsStdKind, bool, T>
[src]
pub const fn coerce(self, reference: &bool) -> PWrapper<bool>
[src]
Copies the value from reference
, and wraps it in a PWrapper
impl<R: ?Sized> IsAFormatMarker<IsStdKind, str, R>
[src]
impl<T> IsAFormatMarker<IsStdKind, Range<usize>, T>
[src]
impl<T> IsAFormatMarker<IsStdKind, RangeFrom<usize>, T>
[src]
impl<T> IsAFormatMarker<IsStdKind, RangeTo<usize>, T>
[src]
impl<T> IsAFormatMarker<IsStdKind, RangeToInclusive<usize>, T>
[src]
pub const fn coerce(
self,
range: &RangeToInclusive<usize>
) -> PWrapper<RangeToInclusive<usize>>
[src]
self,
range: &RangeToInclusive<usize>
) -> PWrapper<RangeToInclusive<usize>>
impl<T> IsAFormatMarker<IsStdKind, RangeInclusive<usize>, T>
[src]
pub const fn coerce(
self,
range: &RangeInclusive<usize>
) -> PWrapper<RangeInclusive<usize>>
[src]
self,
range: &RangeInclusive<usize>
) -> PWrapper<RangeInclusive<usize>>
impl<T> IsAFormatMarker<IsStdKind, RangeFull, T>
[src]
impl<T, __T> IsAFormatMarker<IsStdKind, Option<NonNull<T>>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU8>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI8>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU16>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroU16>
) -> PWrapper<Option<NonZeroU16>>
[src]
self,
reference: &Option<NonZeroU16>
) -> PWrapper<Option<NonZeroU16>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI16>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroI16>
) -> PWrapper<Option<NonZeroI16>>
[src]
self,
reference: &Option<NonZeroI16>
) -> PWrapper<Option<NonZeroI16>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU32>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroU32>
) -> PWrapper<Option<NonZeroU32>>
[src]
self,
reference: &Option<NonZeroU32>
) -> PWrapper<Option<NonZeroU32>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI32>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroI32>
) -> PWrapper<Option<NonZeroI32>>
[src]
self,
reference: &Option<NonZeroI32>
) -> PWrapper<Option<NonZeroI32>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU64>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroU64>
) -> PWrapper<Option<NonZeroU64>>
[src]
self,
reference: &Option<NonZeroU64>
) -> PWrapper<Option<NonZeroU64>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI64>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroI64>
) -> PWrapper<Option<NonZeroI64>>
[src]
self,
reference: &Option<NonZeroI64>
) -> PWrapper<Option<NonZeroI64>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroU128>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroU128>
) -> PWrapper<Option<NonZeroU128>>
[src]
self,
reference: &Option<NonZeroU128>
) -> PWrapper<Option<NonZeroU128>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroI128>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroI128>
) -> PWrapper<Option<NonZeroI128>>
[src]
self,
reference: &Option<NonZeroI128>
) -> PWrapper<Option<NonZeroI128>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroUsize>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroUsize>
) -> PWrapper<Option<NonZeroUsize>>
[src]
self,
reference: &Option<NonZeroUsize>
) -> PWrapper<Option<NonZeroUsize>>
impl<__T> IsAFormatMarker<IsStdKind, Option<NonZeroIsize>, __T>
[src]
pub const fn coerce(
self,
reference: &Option<NonZeroIsize>
) -> PWrapper<Option<NonZeroIsize>>
[src]
self,
reference: &Option<NonZeroIsize>
) -> PWrapper<Option<NonZeroIsize>>
impl<__T> IsAFormatMarker<IsStdKind, Option<u8>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<i8>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<u16>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<i16>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<u32>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<i32>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<u64>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<i64>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<u128>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<i128>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<usize>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<isize>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, Option<bool>, __T>
[src]
impl<'a, __T> IsAFormatMarker<IsStdKind, Option<&'a str>, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU8, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI8, __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU16, __T>
[src]
pub const fn coerce(self, reference: &NonZeroU16) -> PWrapper<NonZeroU16>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI16, __T>
[src]
pub const fn coerce(self, reference: &NonZeroI16) -> PWrapper<NonZeroI16>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU32, __T>
[src]
pub const fn coerce(self, reference: &NonZeroU32) -> PWrapper<NonZeroU32>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI32, __T>
[src]
pub const fn coerce(self, reference: &NonZeroI32) -> PWrapper<NonZeroI32>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU64, __T>
[src]
pub const fn coerce(self, reference: &NonZeroU64) -> PWrapper<NonZeroU64>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI64, __T>
[src]
pub const fn coerce(self, reference: &NonZeroI64) -> PWrapper<NonZeroI64>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroU128, __T>
[src]
pub const fn coerce(self, reference: &NonZeroU128) -> PWrapper<NonZeroU128>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroI128, __T>
[src]
pub const fn coerce(self, reference: &NonZeroI128) -> PWrapper<NonZeroI128>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroUsize, __T>
[src]
pub const fn coerce(self, reference: &NonZeroUsize) -> PWrapper<NonZeroUsize>
[src]
impl<__T> IsAFormatMarker<IsStdKind, NonZeroIsize, __T>
[src]
pub const fn coerce(self, reference: &NonZeroIsize) -> PWrapper<NonZeroIsize>
[src]
impl<T, __T> IsAFormatMarker<IsStdKind, *mut T, __T>
[src]
impl<T, __T> IsAFormatMarker<IsStdKind, *const T, __T>
[src]
impl<T, __T> IsAFormatMarker<IsStdKind, NonNull<T>, __T>
[src]
impl<T: ?Sized, __T> IsAFormatMarker<IsStdKind, PhantomData<T>, __T>
[src]
pub const fn coerce(
self,
reference: &PhantomData<T>
) -> PWrapper<PhantomData<T>>
[src]
self,
reference: &PhantomData<T>
) -> PWrapper<PhantomData<T>>
impl<__T> IsAFormatMarker<IsStdKind, PhantomPinned, __T>
[src]
pub const fn coerce(self, reference: &PhantomPinned) -> PWrapper<PhantomPinned>
[src]
impl<__T> IsAFormatMarker<IsStdKind, (), __T>
[src]
impl<__T> IsAFormatMarker<IsStdKind, AtomicOrdering, __T>
[src]
pub const fn coerce(
self,
reference: &AtomicOrdering
) -> PWrapper<AtomicOrdering>
[src]
self,
reference: &AtomicOrdering
) -> PWrapper<AtomicOrdering>
impl<__T> IsAFormatMarker<IsStdKind, Ordering, __T>
[src]
Trait Implementations
impl<K, T: ?Sized, R: ?Sized> Clone for IsAFormatMarker<K, T, R>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K, T: ?Sized, R: ?Sized> Copy for IsAFormatMarker<K, T, R>
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,