Trait AsValues

Source
pub trait AsValues {
    // Required methods
    fn bits(&self) -> u8;
    fn get(&self, id: u8) -> Option<bool>;

    // Provided methods
    fn copy_into<T>(&self, other: &mut T)
       where T: AsValuesMut { ... }
    fn convert<T>(&self) -> T
       where T: AsValuesMut + Default { ... }
}
Expand description

Something that can be used to get GPIO line values

Required Methods§

Source

fn bits(&self) -> u8

Source

fn get(&self, id: u8) -> Option<bool>

Get the value of specific bit identified by offset

If bit is out of range (0..bits) or not masked then None should be returned.

Provided Methods§

Source

fn copy_into<T>(&self, other: &mut T)
where T: AsValuesMut,

Copy values to another variable

Source

fn convert<T>(&self) -> T
where T: AsValuesMut + Default,

Convert to another representation

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 AsValues for u8

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl AsValues for u16

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl AsValues for u32

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl AsValues for u64

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl AsValues for Vec<Option<bool>>

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl AsValues for Vec<bool>

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl AsValues for [Option<bool>]

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl AsValues for [bool]

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl<T> AsValues for &T
where T: AsValues,

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl<T> AsValues for &mut T
where T: AsValues,

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl<const LEN: usize> AsValues for [Option<bool>; LEN]

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Source§

impl<const LEN: usize> AsValues for [bool; LEN]

Source§

fn bits(&self) -> u8

Source§

fn get(&self, id: u8) -> Option<bool>

Implementors§