Trait mysql_common::misc::raw::bytes::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 Types§

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 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().

Object Safety§

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

§

type Ctx = ()

source§

impl BytesRepr for VarLen

source§

const MAX_LEN: usize = 4_294_967_295usize

source§

const SIZE: Option<usize> = None

§

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

§

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

§

type Ctx = ()

source§

impl BytesRepr for U8Bytes

source§

const MAX_LEN: usize = 255usize

source§

const SIZE: Option<usize> = None

§

type Ctx = ()

source§

impl BytesRepr for U32Bytes

source§

const MAX_LEN: usize = 4_294_967_295usize

source§

const SIZE: Option<usize> = None

§

type Ctx = ()

source§

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

source§

const MAX_LEN: usize = LEN

source§

const SIZE: Option<usize> = _

§

type Ctx = ()

source§

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

source§

const MAX_LEN: usize = MAX_LEN

source§

const SIZE: Option<usize> = None

§

type Ctx = usize