Crate libraildriver

Source
Expand description

§Lib Rail Driver

Rust FFI bindings to the RailDriver.dll library.

These allow you to read and write data to or from Train Simulator 2020. Note that this doesn’t work with Train Sim World.

§Quick example

extern crate libraildriver;

fn main() {
    let context = libraildriver::Context::new();
    let speed = context.get_value(libraildriver::Value::Speedometer,
                  libraildriver::Kind::Current).expect("Failed to get value.");
    println!("The train's current speed is: {}", speed);
}

Structs§

Context
A controller context with the simulator.

Enums§

ControllerValue
The value of data supposedly from the controller, although RailDriver does offer some ‘virtual’ values.
Kind
The kind of value that is required
RailDriverError
Errors returned by the operation being performed.
Value
The value you wish to target for an operation.

Type Aliases§

Result
A custom Result type to simplify dealing with errors.