riot_wrappers::saul

Enum Unit

Source
#[non_exhaustive]
pub enum Unit {
Show 34 variants None, TempC, TempF, TempK, Lux, M, M2, M3, GForce, Dps, Gram, A, V, W, Gauss, T, Dbm, Coulomb, F, Ohm, Ph, Bar, Pa, Cd, Bool, Cts, Percent, Permill, Ppm, Ppb, Time, Date, Gpm3, Cpm3,
}
Available on riot_module_saul only.
Expand description

Unit of measurement required to interpret numeric values in a Phydat exchanged with a SAUL device

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

None

Note that this means “data has no physical unit”, and is distinct from “No unit given”, which is Option::<Unit>::None as opposed to Some(Unit::None).

§

TempC

§

TempF

§

TempK

§

Lux

§

M

§

M2

§

M3

§

GForce

§

Dps

§

Gram

§

A

§

V

§

W

§

Gauss

§

T

§

Dbm

§

Coulomb

§

F

§

Ohm

§

Ph

§

Bar

§

Pa

§

Cd

§

Bool

§

Cts

§

Percent

§

Permill

§

Ppm

§

Ppb

§

Time

§

Date

§

Gpm3

§

Cpm3

Implementations§

Source§

impl Unit

Source

fn from_c(input: u8) -> Option<Self>

Source

fn to_c(input: Option<Self>) -> u8

Source

pub fn name_owned<const S: usize>(self) -> Option<String<S>>

String representation of a given unit (e.g. V, m, none or time)

Trait Implementations§

Source§

impl Clone for Unit

Source§

fn clone(&self) -> Unit

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Unit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for Unit

Auto Trait Implementations§

§

impl Freeze for Unit

§

impl RefUnwindSafe for Unit

§

impl Send for Unit

§

impl Sync for Unit

§

impl Unpin for Unit

§

impl UnwindSafe for Unit

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoSwitch for T

Source§

fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>

Consumes the IoPin returning a Switch of the appropriate ActiveLevel. Read more
Source§

fn into_active_low_switch(self) -> Switch<Self, ActiveLow>
where Self: Sized,

Consumes the IoPin returning a Switch<IoPin, ActiveLow>. Read more
Source§

fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>
where Self: Sized,

Consumes the IoPin returning a Switch<IoPin, ActiveHigh>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 1 byte

Size for each variant:

  • None: 0 bytes
  • TempC: 0 bytes
  • TempF: 0 bytes
  • TempK: 0 bytes
  • Lux: 0 bytes
  • M: 0 bytes
  • M2: 0 bytes
  • M3: 0 bytes
  • GForce: 0 bytes
  • Dps: 0 bytes
  • Gram: 0 bytes
  • A: 0 bytes
  • V: 0 bytes
  • W: 0 bytes
  • Gauss: 0 bytes
  • T: 0 bytes
  • Dbm: 0 bytes
  • Coulomb: 0 bytes
  • F: 0 bytes
  • Ohm: 0 bytes
  • Ph: 0 bytes
  • Bar: 0 bytes
  • Pa: 0 bytes
  • Cd: 0 bytes
  • Bool: 0 bytes
  • Cts: 0 bytes
  • Percent: 0 bytes
  • Permill: 0 bytes
  • Ppm: 0 bytes
  • Ppb: 0 bytes
  • Time: 0 bytes
  • Date: 0 bytes
  • Gpm3: 0 bytes
  • Cpm3: 0 bytes