Crate xplane_plugin [] [src]

The xplane_plugin crate provides an easy way to create X-Plane plugins in Rust.

To import the macro, the crate must be imported like this:

#[macro_use]
extern crate xplane_plugin;

Creating a plugin involves three steps:

  1. Create a struct for your plugin
  2. Implement Plugin for your plugin struct
  3. Place xplane_plugin!(YourPluginStruct) in a file, not in any function

Examples

#[macro_use]
extern crate xplane_plugin;
use xplane_plugin::*;
struct TestPlugin;
impl Plugin for TestPlugin {
    fn start() -> Option<Self> {
        Some(TestPlugin)
    }
    fn enable(&mut self) {

    }
    fn disable(&mut self) {

    }

    fn stop(&mut self) {

    }
    fn info<'a, 'b, 'c>(&self) -> PluginInfo<'a, 'b, 'c> {
        PluginInfo {
            name: "Test Plugin",
            signature: "org.samcrow.rustplugin.test",
            description: "A plugin written in Rust",
        }
    }
}

xplane_plugin!(TestPlugin);

Macros

xplane_plugin

Creates an X-Plane plugin

Structs

PluginInfo

Stores information about a plugin that is provided to X-Plane

Traits

Plugin

The trait that all plugins should implement