Skip to main content

Getting Started

Using the Whole Toolkit

Using the whole toolkit via the umbrella ianaio crate lets you hit the ground running, with everything at your fingertips. This is a good choice for people making Web applications, or top-level crates that are compiled into Wasm binaries.

Cargo.toml

Add a ianaio dependency to your Cargo.toml:

[dependencies]
ianaio = "0.1.7" // Please check for the latest version at crates.io

src/lib.rs

Use various bits of ianaio via its submodules, for example timers and intervals are in ianaio::timers and event listeners are in ianaio::events:

use ianaio::{timers, events};

// ...

Using a Single Crate

Each crate in the IanaIO toolkit can also be used independently from the rest of the toolkit. This is a good choice for people making library crates that are intended to be used by other people making Web applications or top-level crates that are compiled into Wasm binaries.

Cargo.toml

If we want to use only the IanaIO functionality that wraps setTimeout, we can add ianaio-timers to our dependencies in Cargo.toml:

[dependencies]
ianaio-timers = "0.1.1"

src/lib.rs

Next, import the functionality you need from the ianaio_timers crate, and go to town with it:

use ianaio_timers::callback::Timeout;

// ...