Struct IsAWriteMarker

Source
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:

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, R> Freeze for IsAWriteMarker<K, T, R>
where T: ?Sized, R: ?Sized,

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.

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