Skip to main content

incus_client/
lib.rs

1// Render per-item feature-requirement badges when rustdoc runs on nightly with
2// `--cfg docsrs` (docs.rs posture; locally via `cargo xtask doc --docsrs-cfg`).
3// Inert under the stable CI doc gate: stable rustdoc never sets `docsrs`.
4#![cfg_attr(docsrs, feature(doc_auto_cfg))]
5//! Async Rust client for the [Incus REST API](https://linuxcontainers.org/incus/docs/main/rest-api/)
6//! (system container and VM management).
7//!
8//! This crate speaks to the Incus daemon over a **local Unix domain socket
9//! only**. Incus also supports a remote mutual-TLS HTTPS transport with a
10//! trust-on-first-use certificate model, but that surface is *not*
11//! implemented here — it's tracked as a separate follow-up epic pending a
12//! real remote consumer, since a from-scratch TLS trust implementation
13//! carries real security risk that isn't worth taking on speculatively.
14//!
15//! Every operation-returning mutation surfaces a [`operations::Operation`]
16//! rather than assuming synchronous completion — see
17//! [`Client::wait_for_operation`] for the recommended way to wait for one to
18//! finish.
19//!
20//! Unix-only: Incus itself only runs on Linux, and this crate's transport is
21//! a Unix domain socket ([`tokio::net::UnixStream`]) with no cross-platform
22//! equivalent, so the entire crate compiles to nothing on non-Unix targets
23//! (Windows CI, for instance) rather than hard-failing the workspace build -
24//! there is no meaningful non-Unix version of a client for a Linux-only
25//! daemon.
26
27#![cfg(unix)]
28
29pub mod config;
30pub mod error;
31pub mod operations;
32pub mod resources;
33pub mod transport;
34
35#[cfg(feature = "events")]
36pub mod events;
37
38pub use config::ClientConfig;
39pub use error::{Error, Result};
40pub use transport::{Client, WithEtag};