Trait Atom

Source
pub trait Atom:
    'static
    + Copy
    + Debug
    + Default
    + Send
    + Sync {
    const BYTE_SIZE: usize;

    // Required methods
    fn to_bytes(&self) -> Vec<u8> ;
    fn try_from_bytes(bytes: &[u8]) -> CoreResult<Self>
       where Self: Sized;
}

Required Associated Constants§

Required Methods§

Source

fn to_bytes(&self) -> Vec<u8>

Source

fn try_from_bytes(bytes: &[u8]) -> CoreResult<Self>
where Self: Sized,

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 Atom for bool

Source§

impl Atom for f32

Source§

const BYTE_SIZE: usize = 4usize

Source§

fn to_bytes(&self) -> Vec<u8>

Source§

fn try_from_bytes(bytes: &[u8]) -> CoreResult<Self>
where Self: Sized,

Source§

impl Atom for f64

Source§

const BYTE_SIZE: usize = 8usize

Source§

fn to_bytes(&self) -> Vec<u8>

Source§

fn try_from_bytes(bytes: &[u8]) -> CoreResult<Self>

Source§

impl Atom for i64

Source§

const BYTE_SIZE: usize = 8usize

Source§

fn to_bytes(&self) -> Vec<u8>

Source§

fn try_from_bytes(bytes: &[u8]) -> CoreResult<Self>

Source§

impl Atom for u8

Source§

const BYTE_SIZE: usize = 1usize

Source§

fn to_bytes(&self) -> Vec<u8>

Source§

fn try_from_bytes(bytes: &[u8]) -> CoreResult<u8>

Source§

impl Atom for TimestampMicros

Source§

const BYTE_SIZE: usize = 12usize

Source§

fn to_bytes(&self) -> Vec<u8>

Source§

fn try_from_bytes(bytes: &[u8]) -> CoreResult<Self>

Implementors§