mysql_common::misc::raw::bytes

Trait BytesRepr

Source
pub trait BytesRepr {
    type Ctx;

    const MAX_LEN: usize;
    const SIZE: Option<usize>;

    // Required methods
    fn serialize(text: &[u8], buf: &mut Vec<u8>);
    fn deserialize<'de>(
        ctx: Self::Ctx,
        buf: &mut ParseBuf<'de>,
    ) -> Result<Cow<'de, [u8]>>;
}
Expand description

Representation of a serialized bytes.

Required Associated Constants§

Source

const MAX_LEN: usize

Maximum length of bytes for this repr (depends on how lenght is stored).

Source

const SIZE: Option<usize>

Required Associated Types§

Required Methods§

Source

fn serialize(text: &[u8], buf: &mut Vec<u8>)

Source

fn deserialize<'de>( ctx: Self::Ctx, buf: &mut ParseBuf<'de>, ) -> Result<Cow<'de, [u8]>>

Implementation must check the length of the buffer if Self::SIZE.is_none().

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 BytesRepr for LenEnc

Source§

const MAX_LEN: usize = 18_446_744_073_709_551_615usize

Source§

const SIZE: Option<usize> = None

Source§

type Ctx = ()

Source§

impl BytesRepr for VarLen

Source§

const MAX_LEN: usize = 4_294_967_295usize

Source§

const SIZE: Option<usize> = None

Source§

type Ctx = ()

Source§

impl BytesRepr for EofBytes

Source§

const MAX_LEN: usize = 18_446_744_073_709_551_615usize

Source§

const SIZE: Option<usize> = None

Source§

type Ctx = ()

Source§

impl BytesRepr for NullBytes

Source§

const MAX_LEN: usize = 18_446_744_073_709_551_615usize

Source§

const SIZE: Option<usize> = None

Source§

type Ctx = ()

Source§

impl BytesRepr for U8Bytes

Source§

const MAX_LEN: usize = 255usize

Source§

const SIZE: Option<usize> = None

Source§

type Ctx = ()

Source§

impl BytesRepr for U32Bytes

Source§

const MAX_LEN: usize = 4_294_967_295usize

Source§

const SIZE: Option<usize> = None

Source§

type Ctx = ()

Source§

impl<const LEN: usize> BytesRepr for FixedLengthText<LEN>

Source§

impl<const MAX_LEN: usize> BytesRepr for BareBytes<MAX_LEN>

Source§

const MAX_LEN: usize = MAX_LEN

Source§

const SIZE: Option<usize> = None

Source§

type Ctx = usize