Skip to main content

GCDatapointValue

Struct GCDatapointValue 

#[repr(transparent)]
pub struct GCDatapointValue(sGCDatapointValue);
Expand description

Represents a datapoint value that can be published to the core

TODO: Investigate adding generic constructor and getter methods

Tuple Fields§

§0: sGCDatapointValue

Implementations§

§

impl GCDatapointValue

pub fn new_boolean( datapoint_id: u64, timestamp_ns: u64, value: bool, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a boolean value

pub fn new_timestamp_ns( datapoint_id: u64, timestamp_ns: u64, value: u64, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a timestamp as value

pub fn new_u64( datapoint_id: u64, timestamp_ns: u64, value: u64, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a double point value

pub fn new_u32( datapoint_id: u64, timestamp_ns: u64, value: u32, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a 32 bit unsigned integer value

pub fn new_i64( datapoint_id: u64, timestamp_ns: u64, value: i64, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a 64 bit signed integer value

pub fn new_i32( datapoint_id: u64, timestamp_ns: u64, value: i32, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a 32 bit signed integer value

pub fn new_f64( datapoint_id: u64, timestamp_ns: u64, value: f64, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a 64 bit floating point value

pub fn new_f32( datapoint_id: u64, timestamp_ns: u64, value: f32, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a 32 bit floating point value

pub fn new_double_point( datapoint_id: u64, timestamp_ns: u64, value: u8, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a double point value

pub fn new_byte( datapoint_id: u64, timestamp_ns: u64, value: bool, quality: GCDatapointValueQuality, ) -> GCDatapointValue

Creates a new datapoint value with a boolean value

pub fn get_value(&self) -> Result<GCDatapointValueType, GCPluginABIError>

Get the value of the current datapoint This method may add a slight overhead to the execution time, if the value is already known it is recommended to use the specific getter methods It returns an error if the value is not supported or unknown

pub fn set_value(&mut self, value: GCDatapointValueType)

Set the value of the current datapoint TODO: This can maybe be optimized by using unsafe

pub fn get_value_bool(&self) -> Option<bool>

Get the value of the current datapoint as a boolean Returns None if the value is not a boolean

pub fn get_value_double_point(&self) -> Option<u8>

Get the value of the current datapoint as a double point Returns None if the value is not a double point

pub fn get_value_i64(&self) -> Option<i64>

Get the value of the current datapoint as a 64 bit signed integer Returns None if the value is not a 64 bit signed integer

pub fn get_value_i32(&self) -> Option<i32>

Get the value of the current datapoint as a 32 bit signed integer Returns None if the value is not a 32 bit signed integer

pub fn get_value_u32(&self) -> Option<u32>

Get the value of the current datapoint as a 32 bit unsigned integer Returns None if the value is not a 32 bit unsigned integer

pub fn get_value_u64(&self) -> Option<u64>

Get the value of the current datapoint as a 64 bit unsigned integer Returns None if the value is not a 64 bit unsigned integer

pub fn get_value_f64(&self) -> Option<f64>

Get the value of the current datapoint as a 64 bit floating point Returns None if the value is not a 64 bit floating point

pub fn get_value_f32(&self) -> Option<f32>

Get the value of the current datapoint as a 32 bit floating point Returns None if the value is not a 32 bit floating point

pub fn get_value_timestamp_ns(&self) -> Option<u64>

Get the value of the current datapoint as a timestamp in nanoseconds Returns None if the value is not a timestamp

pub fn get_value_bytes(&self) -> Option<Vec<u8>>

Get the value of the current datapoint as a byte array Returns None if the value is not a byte array

pub fn get_timestamp(&self) -> u64

Returns the timestamp of the datapoint value

pub fn get_id(&self) -> u64

Returns the datapoint id of the datapoint value

pub fn get_quality(&self) -> GCDatapointValueQuality

Returns the quality of the datapoint value

pub fn as_raw(&self) -> sGCDatapointValue

Returns the raw representation of the datapoint value

Trait Implementations§

§

impl Clone for GCDatapointValue

§

fn clone(&self) -> GCDatapointValue

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

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

Performs copy-assignment from source. Read more
§

impl Debug for GCDatapointValue

§

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

Formats the value using the given formatter. Read more
§

impl Default for GCDatapointValue

§

fn default() -> GCDatapointValue

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for GCDatapointValue

§

fn deserialize<D>( deserializer: D, ) -> Result<GCDatapointValue, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl GCAbiConversion for GCDatapointValue

§

type CType = sGCDatapointValue

§

fn from_c( c_type: <GCDatapointValue as GCAbiConversion>::CType, ) -> GCDatapointValue

Convert from the C type to the Rust type
§

fn into_c(self) -> <GCDatapointValue as GCAbiConversion>::CType

Convert from the Rust type to the C type
§

fn ref_c(&self) -> &Self::CType

Get a reference to the C type
§

fn from_c_ref(c_type: &Self::CType) -> &Self

Get a reference to the converted type
§

unsafe fn from_c_ptr(ptr: *const Self::CType) -> &'static Self

Get a mutable reference to the C type Read more
§

unsafe fn as_ptr(&self) -> *const Self::CType

Get a immutable reference to the C type Read more
§

unsafe fn as_mut_ptr(&mut self) -> *mut Self::CType

Get a mutable reference to the C type Read more
§

impl PartialEq for GCDatapointValue

§

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

Compares two datapoint values, it returns true if the id, timestamp, quality and value are the same.

If any of the values cannot be retrieved from the datapoint, it will return false.

1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for GCDatapointValue

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. 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, 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> 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, 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,