Skip to main content

GCPluginInterface

Struct GCPluginInterface 

#[repr(transparent)]
pub struct GCPluginInterface(sGCPluginInterface);
Expand description

Zero cost abstraction over the GCPluginInterface Safety: All the function calls are valid as long as the underlying GCPluginInterface pointer is valid

Tuple Fields§

§0: sGCPluginInterface

Implementations§

§

impl GCPluginInterface

pub unsafe fn new<T>( config: GCPluginConfig, ctx: *const T, exports: GCCoreExportedFunctions, log_level: GCLogLevel, ) -> Self

Create a new GCPluginInterface

§Safety

The caller is responsible for ensuring the ctx and config are valid for the lifetime of the GCPluginInterface

pub fn publish_datapoint(&self, datapoint_value: &GCDatapointValue) -> bool

Publishes a datapoint value

pub fn store_datapoint(&self, datapoint_value: &GCDatapointValue)

Stores a datapoint value in the timeseries database

pub fn get_config(&self) -> &GCPluginConfig

Returns the configuration of the plugin

pub unsafe fn get_last_datapoint_value( &self, datapoint_id: GCDatapointID, ) -> *const GCDatapointValue

Retrieve the last value of a datapoint from the realtime database

§Safety

The caller is responsible for freeing the memory of the returned value and also it has to ensure the pointer is not null

pub fn log(&self, level: eGCLogLevel, message: &CStr)

Log a message

pub fn log_audit(&self, message: &CStr)

Log a message audit

pub fn get_raw_log_level(&self) -> eGCLogLevel

Get the C log level of the plugin

pub fn get_log_level(&self) -> Result<GCLogLevel, GCPluginABIError>

Get the log level of the plugin

pub fn get_ethernet_interface(&self, name: &CStr) -> Option<GCEthernetInterface>

Retrieves an Ethernet interface configuration by logical name.

pub fn get_serial_interface(&self, name: &CStr) -> Option<GCSerialInterface>

Retrieves a serial interface configuration by logical name.

Trait Implementations§

§

impl GCAbiConversion for GCPluginInterface

§

type CType = sGCPluginInterface

§

fn from_c(c_type: Self::CType) -> Self

Convert from the C type to the Rust type
§

fn into_c(self) -> Self::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 Send for GCPluginInterface

§

impl Sync for GCPluginInterface

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> 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, 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.