Rust interfaces to the X-Plane plugin SDK
Find a file
Saso Kiselkov 7feef72a93
All checks were successful
Cargo Build & Test / Rust project - latest (push) Successful in 7m41s
Window::set_resizing_limits need to treat max_size set to None in a way to avoid numerical issue in X-Plane.
2026-02-03 15:44:41 +01:00
.forgejo/workflows Enable all features on CI builds. 2025-12-22 16:44:10 +01:00
examples Added menus example 2022-02-16 15:48:28 -08:00
src Window::set_resizing_limits need to treat max_size set to None in a way to avoid numerical issue in X-Plane. 2026-02-03 15:44:41 +01:00
.gitignore Remove editor specific configuration files 2021-05-08 17:34:03 +02:00
Cargo.toml Added id() method to window::Window. 2026-02-03 12:32:02 +01:00
CHANGELOG.md Changelog 2024-11-18 19:30:01 -08:00
LICENSE-APACHE Documentation 2017-01-24 18:10:41 -08:00
LICENSE-MIT Documentation 2017-01-24 18:10:41 -08:00
README.md Added cross-compiling note 2024-01-03 08:07:14 -08:00

X-Plane plugin APIs for Rust

Crates.io Version Documentation License

Purpose

Rust XPLM provides a convenient interface for X-Plane plugin development in the Rust programming language for all platforms.

As we use the X-Plane SDK version 3.0, any plugin created with this library supports X-Plane version 11.10 or later.

Status

The library is still in an incomplete state. As a result some parts of the SDK may only be sparsely covered or missing completely.

  • Compiles and is callable from X-Plane
  • Debug logging to the console / log file
  • DataRef reading and writing
  • Commands
  • GUI - Needs further work
  • Drawing - Needs further work

Example

Some more examples can be found in the examples/ directory.

This small snippet is the minimal boilerplate needed to make your plugin compile.

extern crate xplm;

use xplm::plugin::{Plugin, PluginInfo};
use xplm::{debugln, xplane_plugin};

struct MinimalPlugin;

impl Plugin for MinimalPlugin {
    type Error = std::convert::Infallible;

    fn start() -> Result<Self, Self::Error> {
        // The following message should be visible in the developer console and the Log.txt file
        debugln!("Hello, World! From the Minimal Rust Plugin");
        Ok(MinimalPlugin)
    }

    fn info(&self) -> PluginInfo {
        PluginInfo {
            name: String::from("Minimal Rust Plugin"),
            signature: String::from("org.samcrow.xplm.examples.minimal"),
            description: String::from("A plugin written in Rust"),
        }
    }
}

xplane_plugin!(MinimalPlugin);

Compiling and installing a plugin

cargo new --lib my-rxplm-project
cd my-rxplm-project
cargo add xplm

Then add to Cargo.toml:

[lib]
crate-type = ["cdylib"]

Copy minimal example from above into src/lib.rs

cargo build

Rename target/debug/my_rxplm_project.dll to win.xpl (or my_rxplm_project.so to lin.xpl, etc) and copy to the aircraft/scenery/sim plugins folder

Cross-compiling

The cross tool may help compile plugins for multiple operating systems/architectures.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.