[−][src]Struct const_format::marker_traits::IsAWriteMarker
Hack used to automatically convert a
mutable reference to a StrWriter
to a StrWriterMut
,
and do nothing with other types.
The conversion is done with the coerce
methods.
Type parameters
K
is <R as WriteMarker>::Kind
The kind of type that T
is, either a IsAStrWriter
or IsNotAStrWriter
T
is <R as WriteMarker>::This
:
The R
type after removing all layers of references.
Coerce Method
The coerce
method is what does the conversion from a &mut T
depending on the K
type parameter:
-
IsAStrWriter
: the reference is converted into aStrWriterMut<'_>
. -
IsNotAStrWriter
: the reference is simply returned unchanged.
Implementations
impl<R: ?Sized> IsAWriteMarker<R::Kind, R::This, R> where
R: WriteMarker,
[src]
R: WriteMarker,
impl<K, T: ?Sized, R: ?Sized> IsAWriteMarker<K, T, R>
[src]
pub const fn infer_type(self, _: &R) -> Self
[src]
Infers the type parmaeters of this IsAWriteMarker
with the passed reference.
impl<T: ?Sized, R: ?Sized> IsAWriteMarker<IsAStrWriter, StrWriter<T>, R>
[src]
pub const fn coerce(self, mutref: &mut StrWriter) -> StrWriterMut<'_>
[src]
Converts the &mut StrWriter
to a StrWriterMut<'_>
.
impl<T: ?Sized, R: ?Sized> IsAWriteMarker<IsNotAStrWriter, T, R>
[src]
pub const fn coerce(self, mutref: &mut T) -> &mut T
[src]
An idntity function, just takesmutref
and returns it.
Trait Implementations
impl<K, T: ?Sized, R: ?Sized> Clone for IsAWriteMarker<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 IsAWriteMarker<K, T, R>
[src]
Auto Trait Implementations
impl<K, T: ?Sized, R: ?Sized> RefUnwindSafe for IsAWriteMarker<K, T, R>
impl<K, T: ?Sized, R: ?Sized> Send for IsAWriteMarker<K, T, R>
impl<K, T: ?Sized, R: ?Sized> Sync for IsAWriteMarker<K, T, R>
impl<K, T: ?Sized, R: ?Sized> Unpin for IsAWriteMarker<K, T, R>
impl<K, T: ?Sized, R: ?Sized> UnwindSafe for IsAWriteMarker<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>,