Expand description
§Hydrust Plugin SDK
The official SDK for developing plugins for the Hydrust platform.
This crate provides the necessary types, traits, and macros to define a guest
module that can be loaded by the Hydrust host. It abstracts away the low-level
wit-bindgen details and provides a clean, idiomatic Rust API.
§Usage
To create a plugin, implement the Handler trait on a struct that derives
Default, and then call register_plugin! with that struct type.
ⓘ
use hydrust_sdk::{register_plugin, Handler};
use hydrust_sdk::events::Event;
use hydrust_sdk::metadata::PluginInfo;
#[derive(Default)]
struct MyPlugin;
impl Handler for MyPlugin {
fn metadata(&self) -> PluginInfo {
PluginInfo {
name: "My Plugin".to_string(),
version: "0.1.0".to_string(),
author: "MyName".to_string(),
description: "My plugin does wonders".to_string()
}
}
fn on_event(&self, event: Event) {
// Handle event logic here
}
}
register_plugin!(MyPlugin);Re-exports§
pub use wit_bindgen;
Modules§
- events
- Event definitions and related types.
- metadata
- Metadata structures for plugin registration.
- types
- Core data types used throughout the protocol.
Macros§
- register_
plugin - Registers a struct as the Plugin entry point.
Traits§
- Handler
- The core trait for implementing a Hydrust plugin.
Functions§
- publish
- Functionality related to publishing content.