kRPC Client

Rust client for kRPC (Remote Procedure Calls for Kerbal Space Program).

Status

Work in progress. Bug-reports and contributions welcome. All procedures seem to work, but more testing is needed. Streams work, but Events are still on the way.

toml krpc-client = { git = "https://github.com/kladd/krpc-client" }

Examples

Greet the crew with standard procedure calls.

```rust let client = Client::new("kRPC TEST", "127.0.0.1", 50000, 50001).unwrap();

let sc = SpaceCenter::new(client.clone());

// Check out our vessel. let ship = sc.getactivevessel()?;

// Greet the crew. match ship.getcrew()?.first() { Some(kerbal) => println!( "Hello, {}. Welcome to {}", kerbal.getname()?, ship.getname()? ), None => println!("{} is unkerbaled!", ship.getname()?), }; ```

Using Streams

Keep track of time with streams.

```rust let client = Client::new("kRPC TEST", "127.0.0.1", 50000, 50001)?;

let space_center = SpaceCenter::new(client.clone());

// Set up a stream. let utstream = spacecenter.getutstream()?; utstream.setrate(1f32)?;

// Wait for updates, and print the current value. for _ in 0..10 { utstream.wait(); println!("It's {} o'clock", utstream.get()?); } ```

Features

Hacking