rototo
DocsReference
Reference

Rust SDK Reference

The Rust SDK is the core implementation. Other language SDKs delegate runtime behavior to this code so that loading, lint, refresh, and resolution semantics stay in one place.

Install

[dependencies]
rototo = "0.1.0-alpha.4"
serde_json = "1"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }

Runtime Handle

use rototo::{ResolveContext, Workspace};

let workspace = Workspace::load("examples/basic").await?;
let context = ResolveContext::from_json(serde_json::json!({
    "user": {
        "tier": "premium"
    }
}))?;

let resolution = workspace
    .resolve_variable("premium-message", &context)
    .await?;

Use Workspace::load for application runtime paths. Use Workspace::inspect for tools that need to load a workspace without compiling a runtime model.

Refreshing Handle

use std::time::Duration;
use rototo::{RefreshOptions, RefreshingWorkspace};

let refresh = RefreshOptions::new().with_period(Duration::from_secs(30));
let workspace = RefreshingWorkspace::load(source, refresh).await?;

RefreshingWorkspace keeps the last successfully loaded workspace active when a later refresh fails.

Error Type

SDK calls return rototo::Result<T>, whose error type is RototoError.

API Surface

The Rust crate exposes the broadest SDK surface:

APIPurpose
Workspace::loadLoad, lint, and compile a runtime workspace.
Workspace::inspectLoad workspace files without compiling runtime state.
Workspace::lintRun lint against the loaded root.
Workspace::resolve_variableResolve one variable.
Workspace::resolve_qualifierResolve one qualifier.
RefreshingWorkspace::loadLoad and optionally start periodic refresh.
RefreshingWorkspace::refresh_nowRun a manual refresh.
RefreshingWorkspace::statusRead refresh state.
RefreshingWorkspace::shutdownStop the refresh loop.

The crate also exports lower-level list, read, lint, resolve, trace, source, catalog, and testing helpers for Rust tools and test suites.