//! msb_krun - Native Rust API for libkrun microVMs.
//!
//! This crate provides a builder-pattern API for creating and entering microVMs
//! using libkrun's VMM infrastructure.
//!
//! # Lifecycle
//!
//! [`Vm::enter()`] never returns on success. When the guest shuts down, the
//! VMM calls `_exit()`, killing the entire process. `enter()` only returns
//! `Err` if something fails before the VMM takes over.
//!
//! # Example
//!
//! ```rust,no_run
//! use msb_krun::{VmBuilder, Result};
//!
//! fn main() -> Result<()> {
//!     VmBuilder::new()
//!         .machine(|m| m.vcpus(4).memory_mib(2048))
//!         .fs(|fs| fs.root("/path/to/rootfs"))
//!         .exec(|e| e.path("/bin/myapp").args(["--flag"]).env("HOME", "/root"))
//!         .build()?
//!         .enter()?;
//!
//!     unreachable!()
//! }
//! ```

//--------------------------------------------------------------------------------------------------
// Modules
//--------------------------------------------------------------------------------------------------

pub mod api;
pub mod backends;

//--------------------------------------------------------------------------------------------------
// Re-Exports
//--------------------------------------------------------------------------------------------------

pub use api::builder::VmBuilder;
#[cfg(feature = "blk")]
pub use api::builders::DiskBuilder;
#[cfg(feature = "blk")]
pub use api::builders::DiskImageFormat;
#[cfg(feature = "net")]
pub use api::builders::NetBuilder;
pub use api::builders::{ConsoleBuilder, ExecBuilder, FsBuilder, KernelBuilder, MachineBuilder};
pub use api::error::{BuildError, ConfigError, Error, Result, RuntimeError};
pub use api::vm::Vm;

#[cfg(not(any(feature = "tee", feature = "aws-nitro")))]
pub use backends::fs::DynFileSystem;

#[cfg(feature = "net")]
pub use backends::net::NetBackend;
