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§
Required Methods§
Sourcefn from_ref_for_writer(value: &'a Self::Inner) -> Self::Wr
fn from_ref_for_writer(value: &'a Self::Inner) -> Self::Wr
Casts the reference to the inner type to a WriteTo
reference type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.