Skip to main content

rscni_types/
lib.rs

1//! Shared [CNI specification](https://www.cni.dev/) types for Rust.
2//!
3//! This crate holds the data structures and error type defined by the
4//! [CNI specification v1.1.0](https://github.com/containernetworking/cni/blob/v1.3.0/SPEC.md),
5//! and nothing else. It contains no code that invokes a plugin, and none that is
6//! invoked as one.
7//!
8//! Both sides build on it:
9//!
10//! - [`rscni-plugin`](https://docs.rs/rscni-plugin) — for writing a CNI plugin, the
11//!   process a container runtime invokes.
12//! - `rscni-runtime` (planned) — for invoking CNI plugins, the
13//!   Rust counterpart to Go's `libcni`.
14//!
15//! Because they share these types, a plugin and a runtime written with them agree on
16//! the wire format, and neither has to read the specification again.
17//!
18//! Depend on this crate directly only when you need the types without either side's
19//! machinery, for example to parse a `.conflist` file.
20//!
21//! # Contents
22//!
23//! - [`types`] — network configuration, results, and the `CNI_*` environment variable
24//!   names
25//! - [`legacy`] — the result layout of specification versions 0.3.0 through 0.4.0
26//! - [`error`] — [`Error`](error::Error), covering the specification's error codes and
27//!   plugin-defined ones
28//! - [`version`] — [`PluginInfo`](version::PluginInfo) and version negotiation
29//!
30//! # Supported specification versions
31//!
32//! v0.3.0, v0.3.1, v0.4.0, v1.0.0 and v1.1.0.
33
34/// Re-exported: [`types`] uses its types in public signatures, so a plugin can name
35/// them without depending on `ipnet` itself.
36pub use ipnet;
37
38pub mod error;
39pub mod legacy;
40pub mod types;
41pub mod version;