Struct const_format::marker_traits::IsAWriteMarker
source · pub struct IsAWriteMarker<K, T: ?Sized, R: ?Sized>(_);
Available on crate feature
fmt
only.Expand description
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.
R
: A type that implements WriteMarker
.
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§
source§impl<R> IsAWriteMarker<R::Kind, R::This, R>where
R: ?Sized + WriteMarker,
impl<R> IsAWriteMarker<R::Kind, R::This, R>where R: ?Sized + WriteMarker,
source§impl<K, T: ?Sized, R: ?Sized> IsAWriteMarker<K, T, R>
impl<K, T: ?Sized, R: ?Sized> IsAWriteMarker<K, T, R>
sourcepub const fn infer_type(self, _: &R) -> Self
pub const fn infer_type(self, _: &R) -> Self
Infers the type parmaeters of this IsAWriteMarker
with the passed reference.
source§impl<T: ?Sized, R: ?Sized> IsAWriteMarker<IsAStrWriter, StrWriter<T>, R>
impl<T: ?Sized, R: ?Sized> IsAWriteMarker<IsAStrWriter, StrWriter<T>, R>
sourcepub const fn coerce(self, mutref: &mut StrWriter) -> StrWriterMut<'_>
pub const fn coerce(self, mutref: &mut StrWriter) -> StrWriterMut<'_>
Converts the &mut StrWriter
to a StrWriterMut<'_>
.
source§impl<T: ?Sized, R: ?Sized> IsAWriteMarker<IsNotAStrWriter, T, R>
impl<T: ?Sized, R: ?Sized> IsAWriteMarker<IsNotAStrWriter, T, R>
Trait Implementations§
impl<K, T: ?Sized, R: ?Sized> Copy for IsAWriteMarker<K, T, R>
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§
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
Mutably borrows from an owned value. Read more