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§

source

fn as_out_bytes(&self) -> &OutBytes

Performs the conversion.

source

fn as_mut_out_bytes(&mut self) -> &mut OutBytes

Performs the conversion.

Implementations on Foreign Types§

source§

impl AsOutBytes for [u8; 2]

source§

impl AsOutBytes for [u8; 4]

source§

impl AsOutBytes for [u8; 6]

source§

impl AsOutBytes for [u8; 8]

source§

impl AsOutBytes for [u8; 10]

source§

impl AsOutBytes for [u8; 12]

source§

impl AsOutBytes for [u8; 14]

source§

impl AsOutBytes for [u8; 16]

source§

impl AsOutBytes for [u8; 18]

source§

impl AsOutBytes for [u8; 20]

source§

impl AsOutBytes for [u8; 22]

source§

impl AsOutBytes for [u8; 24]

source§

impl AsOutBytes for [u8; 26]

source§

impl AsOutBytes for [u8; 28]

source§

impl AsOutBytes for [u8; 30]

source§

impl AsOutBytes for [u8; 32]

source§

impl AsOutBytes for [u8; 40]

source§

impl AsOutBytes for [u8; 64]

source§

impl AsOutBytes for [u8; 66]

source§

impl AsOutBytes for [u8; 128]

source§

impl AsOutBytes for [u8; 130]

source§

impl AsOutBytes for [u8; 256]

source§

impl AsOutBytes for [u8; 512]

source§

impl AsOutBytes for [u8; 1024]

source§

impl AsOutBytes for [u8; 2048]

source§

impl AsOutBytes for [u8; 4096]

source§

impl AsOutBytes for [u8; 8192]

source§

impl<T: AsOutBytes + ?Sized> AsOutBytes for &mut T

Implementors§