toio-rs
toio driver in Rust
- Supports all the messages defined in the technical specification.
- Supports async/await.
- Provides the similar capability as JavaScript version.
- Provides the high-level API, which is easy to use.
- Provides the low-level API, which allows fine-grained control and configuration.
- Plans to be cross-platform. The targets are:
- macOS
- Windows 10 (TODO)
- Linux (TODO)
use std::time::Duration;
use toio::Cube;
use tokio::time::delay_for;
#[tokio::main]
async fn main() {
let mut cube = Cube::search().nearest().await.unwrap();
cube.connect().await.unwrap();
cube.go(20, 20, None).await.unwrap();
delay_for(Duration::from_secs(3)).await;
cube.go(-15, -15, None).await.unwrap();
delay_for(Duration::from_secs(3)).await;
cube.go(5, 50, None).await.unwrap();
delay_for(Duration::from_secs(3)).await;
cube.go(50, 5, None).await.unwrap();
delay_for(Duration::from_secs(3)).await;
cube.stop().await.unwrap();
}