pub trait FromRefForWriter<'a> {
    type Inner: ?Sized;
    type Wr: WriteTo + 'a;

    // Required method
    fn from_ref_for_writer(value: &'a Self::Inner) -> Self::Wr;
}
Expand description

Trait to use when using the with_newtype attribute.

This is used to convert a reference to a normal type (like String, Vec<u8> etc. into a type that is a reference to them, like &str, &[u8] etc.), so that the WriteTo implementation can be written only for the reference types, and all the other WriteTo impls will only cast what they have to write to those reference types (via the function below), and then call the WriteTo::write_to method on that reference.

Required Associated Types§

source

type Inner: ?Sized

The inner type to cast.

source

type Wr: WriteTo + 'a

The reference type to cast to.

Required Methods§

source

fn from_ref_for_writer(value: &'a Self::Inner) -> Self::Wr

Casts the reference to the inner type to a WriteTo reference type.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a> FromRefForWriter<'a> for FileBytes

§

type Inner = [u8]

§

type Wr = FileBytesRefWr<'a>

source§

impl<'a> FromRefForWriter<'a> for FileString

§

type Inner = str

§

type Wr = FileStrWr<'a>

source§

impl<'a, T> FromRefForWriter<'a> for FmtWrapper<T>where T: Display + 'a,

§

type Inner = T

§

type Wr = FmtWrapperRefWr<'a, T>