Struct GCBorrowedDatapointValue
pub struct GCBorrowedDatapointValue(/* private fields */);Expand description
A wrapper around a GCDatapointValue that takes ownership of a datapoint value across the C ABI boundary and ensures the memory is deallocated when the object is dropped This wraps the raw C struct returned by the raw::gc_plugin_receive_datapoint function and ensures that the appropriate deallocation function is called when the object is dropped.
It defers from GCDatapointValue in that it ensures that the memory is deallocated when the object is dropped.
NOTE: This object must not be created directly by plugins, it should only be created by the gateway core! For this purpose, the GCDatapointValue object should be used.
Implementations§
§impl GCBorrowedDatapointValue
impl GCBorrowedDatapointValue
pub fn copy(&self) -> GCDatapointValue
pub fn copy(&self) -> GCDatapointValue
Copies the borrowed datapoint value into a new owned datapoint value
Methods from Deref<Target = GCDatapointValue>§
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub 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
Sourcepub fn get_timestamp(&self) -> u64
pub fn get_timestamp(&self) -> u64
Returns the timestamp of the datapoint value
Sourcepub fn get_quality(&self) -> GCDatapointValueQuality
pub fn get_quality(&self) -> GCDatapointValueQuality
Returns the quality of the datapoint value
Sourcepub fn as_raw(&self) -> sGCDatapointValue
pub fn as_raw(&self) -> sGCDatapointValue
Returns the raw representation of the datapoint value