Crates.io | auto-traffic-control |
lib.rs | auto-traffic-control |
version | 0.3.2 |
source | src |
created_at | 2022-04-16 21:06:50.846171 |
updated_at | 2022-05-19 10:21:18.339201 |
description | A video game for programmers about air traffic control |
homepage | https://auto-traffic-control.com |
repository | https://github.com/jdno/auto-traffic-control |
max_upload_size | |
id | 569145 |
size | 9,974 |
Homepage | Documentation | Community
Auto Traffic Control is a video game played by programming. The player's task is to create a program that can safely manage the airspace above two airports.
The game is designed to provide an open-ended sandbox that players can use to freely practice programming. The game provides a language-agnostic gRPC API, giving players free choice of programming language or paradigm.
This crate contains the auto-generated Rust SDK for the game's gRPC API.
First, add auto-traffic-control
as a new dependency to your Cargo.toml
.
[dependencies]
auto-traffic-control = "0.3.2"
You also need to add tonic
, the Rust
implementation of gRPC, and tokio
, the async
runtime, as a dependency.
Then, create a service client and send a request. Check out the documentation to learn about the different services and their endpoints.
The following example queries the version of
the game through the
AtcService
.
use auto_traffic_control::v1::atc_service_client::AtcServiceClient;
use auto_traffic_control::v1::GetVersionRequest;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut atc_service = AtcServiceClient::connect("http://localhost:4747").await?;
let response = atc_service.get_version(GetVersionRequest {}).await?;
let version_field = response.into_inner().version;
if let Some(version) = version_field {
let mut version_string = format!("{}.{}.{}", version.major, version.minor, version.patch);
if !version.pre.is_empty() {
version_string.push('-');
version_string.push_str(&version.pre);
}
println!("Auto Traffic Control is running version '{version_string}'");
} else {
println!("Requesting the version returned an empty response.");
}
Ok(())
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.