pub struct IsAWriteMarker<K, T: ?Sized, R: ?Sized>(/* private fields */);
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, R> Freeze for IsAWriteMarker<K, T, R>
impl<K, T, R> RefUnwindSafe for IsAWriteMarker<K, T, R>
impl<K, T, R> Send for IsAWriteMarker<K, T, R>
impl<K, T, R> Sync for IsAWriteMarker<K, T, R>
impl<K, T, R> Unpin for IsAWriteMarker<K, T, R>
impl<K, T, R> 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
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