Trait FieldType

Source
pub trait FieldType: Sized {
    const IS_SIGNED: bool;
    const TOTAL_BIT_SIZE: usize = _;

    // Required methods
    fn get_bit(&self, bit: usize) -> bool;
    fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self;

    // Provided method
    fn set_field(&self, field: &mut [u8], bit_range: (usize, usize)) { ... }
}

Required Associated Constants§

Provided Associated Constants§

Required Methods§

Source

fn get_bit(&self, bit: usize) -> bool

Source

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Provided Methods§

Source

fn set_field(&self, field: &mut [u8], bit_range: (usize, usize))

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

Source§

const IS_SIGNED: bool = false

Source§

fn get_bit(&self, _bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for i8

Source§

const IS_SIGNED: bool = true

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for i16

Source§

const IS_SIGNED: bool = true

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for i32

Source§

const IS_SIGNED: bool = true

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for i64

Source§

const IS_SIGNED: bool = true

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for i128

Source§

const IS_SIGNED: bool = true

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for u8

Source§

const IS_SIGNED: bool = false

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for u16

Source§

const IS_SIGNED: bool = false

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for u32

Source§

const IS_SIGNED: bool = false

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for u64

Source§

const IS_SIGNED: bool = false

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Source§

impl FieldType for u128

Source§

const IS_SIGNED: bool = false

Source§

fn get_bit(&self, bit: usize) -> bool

Source§

fn get_field(field: &[u8], bit_range: (usize, usize)) -> Self

Implementors§