Element

Trait Element 

Source
pub trait Element: Sized {
    const DATA_TYPE: KeyDataType;

    // Required methods
    fn append_to(&self, key: &mut TupleKey);
    fn parse_from(buf: &[u8]) -> Result<Self, &'static str>;

    // Provided method
    fn key_data_type(&self) -> KeyDataType { ... }
}

Required Associated Constants§

Required Methods§

Source

fn append_to(&self, key: &mut TupleKey)

Source

fn parse_from(buf: &[u8]) -> Result<Self, &'static str>

Provided Methods§

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.

Implementations on Foreign Types§

Source§

impl Element for i32

Source§

const DATA_TYPE: KeyDataType = KeyDataType::sfixed32

Source§

fn append_to(&self, key: &mut TupleKey)

Source§

fn parse_from(buf: &[u8]) -> Result<Self, &'static str>

Source§

impl Element for i64

Source§

const DATA_TYPE: KeyDataType = KeyDataType::sfixed64

Source§

fn append_to(&self, key: &mut TupleKey)

Source§

fn parse_from(buf: &[u8]) -> Result<Self, &'static str>

Source§

impl Element for u32

Source§

const DATA_TYPE: KeyDataType = KeyDataType::fixed32

Source§

fn append_to(&self, key: &mut TupleKey)

Source§

fn parse_from(buf: &[u8]) -> Result<Self, &'static str>

Source§

impl Element for u64

Source§

const DATA_TYPE: KeyDataType = KeyDataType::fixed64

Source§

fn append_to(&self, key: &mut TupleKey)

Source§

fn parse_from(buf: &[u8]) -> Result<Self, &'static str>

Source§

impl Element for ()

Source§

const DATA_TYPE: KeyDataType = KeyDataType::unit

Source§

fn append_to(&self, key: &mut TupleKey)

Source§

fn parse_from(buf: &[u8]) -> Result<Self, &'static str>

Source§

impl Element for String

Source§

const DATA_TYPE: KeyDataType = KeyDataType::string

Source§

fn append_to(&self, key: &mut TupleKey)

Source§

fn parse_from(buf: &[u8]) -> Result<Self, &'static str>

Implementors§