pub trait TypeWrite {
type Value: ?Sized;
// Required method
fn write_one<W: Write>(&self, writer: W, value: &Self::Value) -> Result<()>
where Self: Sized;
}
Expand description
Like some sort of for<W: io::Write> Fn(W, &T) -> io::Result<()>
.
To obtain one of these, use the Serialize
trait.
For an example of how to implement this manually, see Vector5
in the
roundtrip test.
Trait objects
dyn TypeWrite
has no object-safe methods.
If you need dynamic polymorphism, use dyn
TypeWriteDyn
instead.