zlayer_hcs/lib.rs
1//! Safe Rust wrapper for the Windows Host Compute Service (HCS).
2//!
3//! HCS is the OS-level API powering Windows containers and Hyper-V-isolated
4//! workloads; the underlying surface lives in `vmcompute.dll`. This crate
5//! wraps those raw calls with RAII handle types, async operation helpers that
6//! translate HCS's native completion-callback model into Rust futures, and
7//! JSON schema types that match the current hcsshim schema v2.
8//!
9//! The crate is Windows-only. On every other platform it compiles to an
10//! empty stub so callers can depend on it unconditionally.
11//!
12//! # `unsafe` policy
13//!
14//! This crate is the authoritative Windows HCS FFI boundary for `ZLayer`. It
15//! exists specifically to wrap the unsafe `vmcompute.dll` entry points behind
16//! safe, typed Rust APIs, so `unsafe` is allowed at the crate level here even
17//! though the workspace-wide policy (`-W unsafe-code`) forbids it everywhere
18//! else. Every `unsafe` block, `unsafe impl`, `unsafe fn`, and `unsafe` method
19//! in this crate carries a `SAFETY:` comment explaining why the required
20//! invariants hold — do not add a new `unsafe` site without one.
21
22#![cfg(windows)]
23#![allow(unsafe_code)]
24
25pub mod enumerate;
26pub mod error;
27pub mod events;
28pub mod handle;
29pub mod operation;
30pub mod process;
31pub mod schema;
32pub mod stats;
33pub mod system;
34
35pub use handle::SendHandle;