|0.9.5||Aug 9, 2021|
|0.9.4||Aug 9, 2021|
#390 in WebAssembly
32 downloads per month
Rust bindings for Yare.io bots
This crate uses
wasm-bindgen to expose the objects available to
Yare.io bots to Rust.
It's meant to be used with
which contains custom build scripts necessary to make
wasm-bindgen work with Yare.
This crate is documented with Rustdoc.
This crate is compatible with TypeScript, but you will need to use the TypeScript types from
See also yare-rust for an alternative to this crate.
The methods and structs this crate provides map pretty directly to what's available in JS.
This means they won't always be idiomatic Rust. For example,
Deref-based inheritance is ued extensively;
this is an antipattern for idiomatic
Rust but it's also the most performant way to represent JS inheritance hierarchies, and it's what
The idiomatic alternative would be to use trait objects, but this would add additional dynamic dispatch on top of what
JS already does, making it slower.
Passing values between WebAssembly and JS is slow, especially when those values aren't numbers. Generally, any method in this crate that returns a value involves such a transfer of data (functions that return static references don't). So be careful, and only retrieve the information you need.
For the reasons mentioned in the previous paragraphs, you may want to create you own structs and data structures to store the information you need.
To access shape-specific methods like
explode(), you'll need to enable the crate feature
corresponding to the shape you play with in your
Cargo.toml. The available shape features are
This crate has a
prelude module that re-exports the most useful items. You can bulk-import them all with
This crate optionally provides bindings for
RenderService, under the
render_service module. You will need to enable the crate's
RenderService feature to
use these bindings.