Trait hex_conservative::buf_encoder::AsOutBytes
source · pub trait AsOutBytes: Sealed {
// Required methods
fn as_out_bytes(&self) -> &OutBytes;
fn as_mut_out_bytes(&mut self) -> &mut OutBytes;
}
Expand description
Trait for types that can be soundly converted to OutBytes
.
To protect the API from future breakage this sealed trait guards which types can be used with
the Encoder
. Currently it is implemented for byte arrays of various interesting lengths.
§Safety
This is not unsafe
yet but the as_out_bytes
should always return the same reference if the
same reference is supplied. IOW the returned memory address and length should be the same if
the input memory address and length are the same.
If the trait ever becomes unsafe
this will be required for soundness.
Required Methods§
sourcefn as_out_bytes(&self) -> &OutBytes
fn as_out_bytes(&self) -> &OutBytes
Performs the conversion.
sourcefn as_mut_out_bytes(&mut self) -> &mut OutBytes
fn as_mut_out_bytes(&mut self) -> &mut OutBytes
Performs the conversion.