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:

Implementations§

source§

impl<R> IsAWriteMarker<R::Kind, R::This, R>where R: ?Sized + WriteMarker,

source

pub const NEW: Self = _

Constructs a IsAWriteMarker

source§

impl<K, T: ?Sized, R: ?Sized> IsAWriteMarker<K, T, R>

source

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>

source

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>

source

pub const fn coerce(self, mutref: &mut T) -> &mut T

An idntity function, just takesmutref and returns it.

Trait Implementations§

source§

impl<K, T: ?Sized, R: ?Sized> Clone for IsAWriteMarker<K, T, R>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.