Skip to main content

AttrNumber

Enum AttrNumber 

Source
pub enum AttrNumber {
    Double(f64),
    Long(i64),
    ULong(u64),
}
Expand description

A limit of an attribute: one of the bounds of one of its ranges, or the delta of its read-different-from-set alarm.

Tango carries these as strings, the type to read them as being the one of the attribute they belong to, and they are numbers by the time they get here: a limit is something to compare a value against, which is not something a string does.

They are not all the same number, though. A limit is a value of the attribute itself, so an attribute of the widest integer kinds has limits a double cannot hold without rounding them, and the three ways a Tango value is a number are kept apart rather than all being flattened into one:

  • a floating attribute, DevFloat or DevDouble, has Self::Double limits;
  • a signed one, up to DevLong64, has Self::Long limits;
  • an unsigned one, up to DevULong64, has Self::ULong limits.

A device that writes a limit its own type cannot hold — half a unit on an integer attribute — still has a limit, and it is read as a Self::Double rather than lost.

Two limits compare as the quantities they stand for, whatever variant each is, so that Long(2) and Double(2.0) are equal: two integers are compared exactly, the widest ones included, and anything else as doubles, a not-a-number being equal to nothing and ordered with nothing.

Variants§

§

Double(f64)

§

Long(i64)

§

ULong(u64)

Implementations§

Source§

impl AttrNumber

Source

pub fn as_f64(self) -> f64

This limit as a double, which is what comparing it against a value of any other kind goes through, the widest integers losing their last digits the way they do in any other conversion to a double.

Trait Implementations§

Source§

impl Clone for AttrNumber

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for AttrNumber

Source§

impl Debug for AttrNumber

Source§

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

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

impl Display for AttrNumber

Source§

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

Written the way a device writes it, which is what it goes back on the wire as.

Source§

impl From<f32> for AttrNumber

Source§

fn from(value: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for AttrNumber

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for AttrNumber

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for AttrNumber

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for AttrNumber

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for AttrNumber

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for AttrNumber

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for AttrNumber

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for AttrNumber

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for AttrNumber

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AttrNumber

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for AttrNumber

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Model for T
where T: Send + Sync + 'static,

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more