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.
Implementors§
Source§impl<'a> FromRefForWriter<'a> for FileBytes
impl<'a> FromRefForWriter<'a> for FileBytes
Source§impl<'a> FromRefForWriter<'a> for FileString
impl<'a> FromRefForWriter<'a> for FileString
Source§impl<'a, T> FromRefForWriter<'a> for Json<T>where
T: Serialize + for<'d> Deserialize<'d> + 'static,
Available on crate feature json only.
impl<'a, T> FromRefForWriter<'a> for Json<T>where
T: Serialize + for<'d> Deserialize<'d> + 'static,
Available on crate feature
json only.Source§impl<'a, T> FromRefForWriter<'a> for Ron<T>where
T: Serialize + for<'d> Deserialize<'d> + 'static,
Available on crate feature ron only.
impl<'a, T> FromRefForWriter<'a> for Ron<T>where
T: Serialize + for<'d> Deserialize<'d> + 'static,
Available on crate feature
ron only.Source§impl<'a, T> FromRefForWriter<'a> for CleanDir<T>where
T: DirStructureItem + 'a,
impl<'a, T> FromRefForWriter<'a> for CleanDir<T>where
T: DirStructureItem + 'a,
Source§impl<'a, T> FromRefForWriter<'a> for FmtWrapper<T>where
T: Display + 'a,
impl<'a, T> FromRefForWriter<'a> for FmtWrapper<T>where
T: Display + 'a,
Source§impl<'a, T> FromRefForWriter<'a> for Toml<T>where
T: Serialize + for<'d> Deserialize<'d> + 'static,
Available on crate feature toml only.
impl<'a, T> FromRefForWriter<'a> for Toml<T>where
T: Serialize + for<'d> Deserialize<'d> + 'static,
Available on crate feature
toml only.