# Rust development and releases
[Quickstart and API reference][quickstart]
This guide is for contributors with access to the private `uniformlabs/multiliquid-svm-sdk` repository.
Package consumers can use the [quickstart], [integration guide][integration], and [examples][guides]
without repository access.
Run Cargo commands from the repository root. From `rust/`, omit `--manifest-path rust/Cargo.toml`.
## Local dependency
To test changes in another application, point its manifest at this checkout:
```toml
[dependencies]
multiliquid-svm-sdk = { path = "../multiliquid-svm-sdk/rust" }
```
## Generate sources and fixtures
Generation requires Node.js 24 and the TypeScript development dependencies:
```bash
cd typescript
npm ci
npm run generate:rust
npm run generate:rust-fixtures
```
`generate:rust` generates native clients and copies IDLs. `generate:rust-fixtures` builds TypeScript and generates
cross-language fixtures and bundled registry data. Edit the source or generator rather than generated files.
Rust consumers need neither Node.js nor an adjacent program checkout.
## Check changes
From the repository root:
```bash
cargo fmt --manifest-path rust/Cargo.toml --all -- --check
cargo clippy --manifest-path rust/Cargo.toml --locked --all-targets --all-features -- -D warnings
cargo test --manifest-path rust/Cargo.toml --locked --all-features
cargo test --manifest-path rust/Cargo.toml --locked --no-default-features
RUSTDOCFLAGS="-D warnings" cargo doc --manifest-path rust/Cargo.toml --locked --no-deps --all-features
RUSTDOCFLAGS="-D warnings" cargo doc --manifest-path rust/Cargo.toml --locked --no-deps --no-default-features
cargo run --manifest-path rust/Cargo.toml --locked --no-default-features --example offline_quote
```
For shared behavior or fixture changes, also run the TypeScript build, lint, formatting, and unit-test checks.
Local tests and fixture parity do not verify live-chain execution.
## Public documentation
`src/lib.rs` includes the Rust README as the API landing page. `src/guides.rs` embeds the Markdown guides in
`docs/` and the runnable programs in `examples/`; maintain those source files rather than duplicating their contents.
The quickstart and embedded programs are also checked by `cargo test` as doctests. The HTTP program is compiled
without execution when the `http` feature is enabled and shown as an untested example otherwise; the offline programs
run with either feature configuration. `tests/readme.rs` checks that the repository README repeats the quickstart
program exactly.
Build with `cargo doc --manifest-path rust/Cargo.toml --locked --no-deps --all-features --open` to preview the
landing page and guides. Do not link package readers to private GitHub files.
Write links in the README and guides as Markdown reference links, such as `[integration guide][integration]`.
Each file ends with definitions for readers outside rustdoc: the README uses version-pinned docs.rs URLs for crates.io,
and the guides use relative paths for GitHub. `src/lib.rs` and `src/guides.rs` define the same labels as intra-doc
links before including the Markdown. Markdown uses the first definition of a label, so rustdoc links stay within
the built version. Add a label to both places when adding a link.
## Package and publish
Rust versions are independent of the npm package. Update `rust/Cargo.toml`, `rust/Cargo.lock`, and the repository
changelog for a release. Also update the version in `cargo add` commands, dependency examples, and docs.rs links in
both READMEs and `rust/docs/`, then commit the changes.
[docs.rs builds documentation from published crates](https://docs.rs/about/builds). Merging this repository's
documentation changes does not update docs.rs. Previously published crate versions are immutable: publish a new
patch version to update the public documentation. The `0.1.1` documentation remains a snapshot of that release;
use [the latest Rust documentation](https://docs.rs/multiliquid-svm-sdk/latest/multiliquid_svm_sdk/) for current guidance.
Inspect and verify the package before uploading:
```bash
cargo package --manifest-path rust/Cargo.toml --locked --list
cargo publish --manifest-path rust/Cargo.toml --locked --dry-run
```
`--locked` uses the dependency versions in `Cargo.lock` and fails if the lockfile needs updating. For a local
snapshot check before committing, add `--allow-dirty`. Dry runs do not upload a crate.
The package includes Rust sources, IDLs, registry data, examples, tests, guides, the Rust README, and the MIT license.
See the [Cargo publishing guide](https://doc.rust-lang.org/cargo/reference/publishing.html) for authentication and
Uniform Labs team ownership setup. To upload the release:
```bash
cargo publish --manifest-path rust/Cargo.toml --locked
```
After publication, check the docs.rs build and open the quickstart, each guide, and the complete examples without
GitHub authentication. Tag the published commit with a Rust-specific version, such as `rust-v0.1.2`.
[quickstart]: ../README.md
[integration]: integration.md
[guides]: ../examples/