Expand description
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
MultiMap
from a list of key-value tuples
Structs§
- Attribute
- A single piece of information that partly determines the state of a plugin.
- Multi
Map - Plugin
- A Plugin combines the data that determines its state and with its functionality.
- Plugin
Data - An opaque struct that contains the state of an individual plugin.
- Plugin
Uninitialized Error - 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.
- Value
Conversion Error - 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§
Traits§
- PluginAPI
- The set of functions that must be implemented by a plugin.
- Plugin
Error - 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 Aliases§
- Attributes
- The type signature of the collection of attributes that is owned by the plugin.
- Kpal
Library Init - The type signature of the function that initializes a library.
- Kpal
Plugin Init - 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.