[−][src]Enum iracing::telemetry::Value
Telemetry Value
Represents a single value in the telemetry. Telemetry data is always quantitive but may be of varying numeric types, plus boolean.
The iRacing Telemetry documentation describes the data-type expected for a given telemetry measurement.
Into
can be used when the expected data type is known, else match
can be used to dynamically handle the
returned data type.
Examples
Known, Expected Data Type
use iracing::telemetry::Sample; let s: Sample = some_sample_getter(); let gear: i32 = s.get("Gear").unwrap().into();
Unknown data type
use iracing::telemtry::{Sample, Value}; let v: &'static str = some_input_for_var_name(); let s: Sample = some_sample_getter(); match s.get(v) { None => println!("Didn't find that value"); Some(value) => match { Value::CHAR(c) => println!("Value: {:x}", c), Value::BOOL(b) => println!("Yes") if b, Value::INT(i) => println!("Value: {}", i), Value::BITS(u) => println!("Value: 0x{:32b}", u), Value::FLOAT(f) | Value::DOUBLE(f) => println!("Value: {:.2}", f), _ => println!("Unknown Value") } };
Variants
CHAR(u8)
BOOL(bool)
INT(i32)
BITS(u32)
FLOAT(f32)
DOUBLE(f64)
UNKNOWN(())
Methods
impl Value
[src]
Trait Implementations
impl Clone for Value
[src]
impl Debug for Value
[src]
impl<'de> Deserialize<'de> for Value
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl From<i32> for Value
[src]
impl Into<Vec<bool>> for Value
[src]
impl Into<bool> for Value
[src]
impl Serialize for Value
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl TryInto<f32> for Value
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_into(self) -> Result<f32, Self::Error>
[src]
impl TryInto<f64> for Value
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_into(self) -> Result<f64, Self::Error>
[src]
impl TryInto<i32> for Value
[src]
type Error = &'static str
The type returned in the event of a conversion error.
fn try_into(self) -> Result<i32, Self::Error>
[src]
impl TryInto<u32> for Value
[src]
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,