[][src]Struct ht16k33::LedLocation

pub struct LedLocation {
    pub row: DisplayDataAddress,
    pub common: DisplayData,
}

Represents the LED location.

The LED location is a (DisplayDataAddress, DisplayData) pair, created from a validated (row, common) pair of u8 values.

Example

use ht16k33::LedLocation;
use ht16k33::DisplayData;
use ht16k33::DisplayDataAddress;
use ht16k33::ValidationError;

let row = 1u8;
let common = 2u8;

let location = LedLocation::new(row, common)?;

assert_eq!(ht16k33::DisplayDataAddress::ROW_1, location.row);
assert_eq!(ht16k33::DisplayData::COMMON_2, location.common);

Fields

row: DisplayDataAddress

The Display RAM row address.

common: DisplayData

The Display RAM common data.

Methods

impl LedLocation[src]

pub fn new(row: u8, common: u8) -> Result<Self, ValidationError>[src]

Create an LedLocation with the given row and common values.

Errors

The row and common values are validated to be within their respective ROWS_SIZE and COMMONS_SIZE ranges of the device. If validation fails then ht16k33::ValidationError::ValueTooLarge is returned.

use ht16k33::LedLocation;
use ht16k33::ValidationError;

let location = match LedLocation::new(row, common) {
    Ok(location) => location,
    Err(ValidationError) => panic!(),
};

pub fn row_as_index(self) -> usize[src]

Return the row value.

Trait Implementations

impl Eq for LedLocation[src]

impl Ord for LedLocation[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl PartialEq<LedLocation> for LedLocation[src]

impl Copy for LedLocation[src]

impl Clone for LedLocation[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialOrd<LedLocation> for LedLocation[src]

impl Default for LedLocation[src]

impl Debug for LedLocation[src]

impl Display for LedLocation[src]

impl Hash for LedLocation[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for LedLocation

impl Sync for LedLocation

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]