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: sGCDatapointValueImplementations§
§impl GCDatapointValue
impl GCDatapointValue
pub fn new_boolean(
datapoint_id: u64,
timestamp_ns: u64,
value: bool,
quality: GCDatapointValueQuality,
) -> 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
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
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
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
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
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
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
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
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
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>
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>>
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
pub fn get_timestamp(&self) -> u64
Returns the timestamp of the datapoint value
pub fn get_quality(&self) -> GCDatapointValueQuality
pub fn get_quality(&self) -> GCDatapointValueQuality
Returns the quality of the datapoint value
pub fn as_raw(&self) -> sGCDatapointValue
pub fn as_raw(&self) -> sGCDatapointValue
Returns the raw representation of the datapoint value
Trait Implementations§
§impl Clone for GCDatapointValue
impl Clone for GCDatapointValue
§fn clone(&self) -> GCDatapointValue
fn clone(&self) -> GCDatapointValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for GCDatapointValue
impl Debug for GCDatapointValue
§impl Default for GCDatapointValue
impl Default for GCDatapointValue
§fn default() -> GCDatapointValue
fn default() -> GCDatapointValue
§impl<'de> Deserialize<'de> for GCDatapointValue
impl<'de> Deserialize<'de> for GCDatapointValue
§fn deserialize<D>(
deserializer: D,
) -> Result<GCDatapointValue, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<GCDatapointValue, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl GCAbiConversion for GCDatapointValue
impl GCAbiConversion for GCDatapointValue
type CType = sGCDatapointValue
§fn from_c(
c_type: <GCDatapointValue as GCAbiConversion>::CType,
) -> GCDatapointValue
fn from_c( c_type: <GCDatapointValue as GCAbiConversion>::CType, ) -> GCDatapointValue
§fn into_c(self) -> <GCDatapointValue as GCAbiConversion>::CType
fn into_c(self) -> <GCDatapointValue as GCAbiConversion>::CType
§fn from_c_ref(c_type: &Self::CType) -> &Self
fn from_c_ref(c_type: &Self::CType) -> &Self
§unsafe fn from_c_ptr(ptr: *const Self::CType) -> &'static Self
unsafe fn from_c_ptr(ptr: *const Self::CType) -> &'static Self
§unsafe fn as_mut_ptr(&mut self) -> *mut Self::CType
unsafe fn as_mut_ptr(&mut self) -> *mut Self::CType
§impl PartialEq for GCDatapointValue
impl PartialEq for GCDatapointValue
§fn eq(&self, other: &GCDatapointValue) -> bool
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.