Octri

Languages

Rust

The Rust SDK publishes to crates.io.

Install

bash
cargo add your-org-api-client

Or in Cargo.toml:

toml
[dependencies]
your-org-api-client = "1.0"

Options

OptionValuesDefault
Client stylefunctions, namespaced, class, class-namespacedfunctions
Argument styleobject, positionalobject
Namespacetags, pathtags
Doc commentsfull, minimalfull
File headeromit, includeomit
Usage examplefull, concisefull
Keep Doc comments on full

Doc comments set to full becomes rustdoc, which is what your users read on docs.rs. Rust consumers expect that page to be complete, and minimal leaves it bare.

Package name

Crate names are global, flat, and first-come-first-served. There are no scopes, so the good short names went years ago:

text
acme-api
crates.io is permanent and unscoped

A crate name cannot be transferred away from you, reused, or renamed, and a published version can be yanked but never replaced. With no namespace to hide behind, pick a name you can live with. See Publishing.

What callers write

rust
use acme::Client;

#[tokio::main]
async fn main() -> Result<(), acme::Error> {
    let client = Client::new(std::env::var("ACME_TOKEN")?);

    let mut users = client.users().list(100);
    while let Some(user) = users.next().await? {
        println!("{}", user.id);
    }

    Ok(())
}

Errors come back as a typed Result, so a caller who ignores a failure gets a compiler warning rather than a silent bug.