CellEncoding

Trait CellEncoding 

Source
pub trait CellEncoding:
    Copy
    + Debug
    + Default
    + Zero
    + One
    + PartialEq {
    // Required methods
    fn cell_type() -> CellType;
    fn into_cell_value(self) -> CellValue;

    // Provided method
    fn static_cast<T: CellEncoding + Sized>(value: T) -> Option<Self> { ... }
}
Expand description

Trait for marking Rust primitives as having a corresponding CellType.

For example, f64 is CellEncoding through CellType::Float64, but isize is not CellEncoding.

Required Methods§

Source

fn cell_type() -> CellType

Returns the CellType covering Self.

Source

fn into_cell_value(self) -> CellValue

Converts self into a CellValue.

Provided Methods§

Source

fn static_cast<T: CellEncoding + Sized>(value: T) -> Option<Self>

Convert dynamic type to static type when logically known. Returns None if given value isn’t actually the exact same type as encoding.

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 CellEncoding for f32

Source§

impl CellEncoding for f64

Source§

impl CellEncoding for i8

Source§

impl CellEncoding for i16

Source§

impl CellEncoding for i32

Source§

impl CellEncoding for i64

Source§

impl CellEncoding for u8

Source§

impl CellEncoding for u16

Source§

impl CellEncoding for u32

Source§

impl CellEncoding for u64

Implementors§