[−][src]Crate kpal_plugin
The KPAL plugin crate provides tools to write your own KPAL plugins.
See the examples folder for ideas on how to implement the datatypes and methods defined in this library.
Modules
error_codes | Constants that indicate specific error codes that a plugin can return. |
Macros
declare_plugin | Creates the required symbols for a plugin library. |
multimap | Create a |
Structs
Attribute | A single piece of information that partly determines the state of a plugin. |
MultiMap | |
Plugin | A Plugin combines the data that determines its state and with its functionality. |
PluginData | An opaque struct that contains the state of an individual plugin. |
PluginUninitializedError | An error that is raised when a plugin is assumed to be in its run phase but it has not yet been initialized. |
VTable | A table of function pointers that comprise the plugin API for the foreign function interface. |
ValueConversionError | An error type that represents a failure to convert a Val to a Value. |
Enums
Callbacks | Callback functions that communicate with the hardware when an attribute is read or set. |
Val | A wrapper type for transporting Values through the plugin API. |
Value | An owned value of an attribute. |
Constants
ATTRIBUTE_PRE_INIT_FALSE | Indicates that an attribute may not be set before plugin initialization. |
ATTRIBUTE_PRE_INIT_TRUE | Indicates that an attribute may be set before plugin initialization. |
INIT_PHASE | Indicates that the init phase callbacks should be used when interacting with a plugin. |
RUN_PHASE | Indicates that the run phase callbacks should be used when interacting with a plugin. |
Statics
ERRORS |
Traits
PluginAPI | The set of functions that must be implemented by a plugin. |
PluginError | The set of functions that must be implemented by a plugin library's main error type. |
Functions
attribute_count⚠ | Returns the number of attributes of the plugin. |
attribute_ids⚠ | Writes the plugin's attribute IDs to a buffer that is provided by the caller. |
attribute_name⚠ | Writes the name of an attribute to a buffer that is provided by the caller. |
attribute_pre_init⚠ | Indicates whether an attribute may be set before initialization. |
attribute_value⚠ | Writes the value of an attribute to a Value instance that is provided by the caller. |
copy_string⚠ | Copies a string of values of a primitive data type to a buffer. |
error_message_ns | Returns an error message to the daemon given an error code. |
plugin_free | Frees the memory associated with the plugin's data. |
plugin_init⚠ | Initializes a plugin. |
set_attribute_value⚠ | Sets the value of an attribute. |
Type Definitions
Attributes | The type signature of the collection of attributes that is owned by the plugin. |
KpalLibraryInit | The type signature of the function that initializes a library. |
KpalPluginInit | The type signature of the function that returns a new plugin instance. |
Phase | Determines which callbacks to use by indicating the current lifecycle phase of the plugin when getting and setting attributes. |