pub trait With<F> {
// Required methods
fn shape() -> Shape;
fn read(v: &ValueRef<'_>, cx: &mut Reader<'_>) -> Option<F>;
fn write(f: &F) -> Value;
// Provided methods
fn absent() -> Option<F> { ... }
fn skip(_f: &F) -> bool { ... }
fn encode(f: &F, w: &mut Writer) { ... }
fn decode(d: &mut Decoder<'_>) -> Option<F> { ... }
fn pack(f: &F, p: &mut Packer) { ... }
fn unpack(u: &mut Unpacker<'_>) -> Option<F> { ... }
}Expand description
How a field of type F is read and written.
Required Methods§
fn shape() -> Shape
fn read(v: &ValueRef<'_>, cx: &mut Reader<'_>) -> Option<F>
fn write(f: &F) -> Value
Provided Methods§
Sourcefn encode(f: &F, w: &mut Writer)
fn encode(f: &F, w: &mut Writer)
The field in the binary form, straight: its value encoded unless the codec knows better.
Sourcefn decode(d: &mut Decoder<'_>) -> Option<F>
fn decode(d: &mut Decoder<'_>) -> Option<F>
The field from the binary form, straight; None sends the read the
slow way (see Schema::decode).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".