Files
herolib_rust/packages/system/virt/src/rhai.rs
2025-08-26 16:50:59 +02:00

60 lines
1.7 KiB
Rust

//! Rhai wrappers for Virt module functions
//!
//! This module provides Rhai wrappers for the functions in the Virt module,
//! including Buildah, Nerdctl, and RFS functionality.
use rhai::{Engine, EvalAltResult};
pub mod buildah;
pub mod nerdctl;
pub mod rfs;
pub mod qcow2;
pub mod cloudhv;
pub mod hostcheck;
pub mod image_prep;
pub mod cloudhv_builder;
/// Register all Virt module functions with the Rhai engine
///
/// # Arguments
///
/// * `engine` - The Rhai engine to register the functions with
///
/// # Returns
///
/// * `Result<(), Box<EvalAltResult>>` - Ok if registration was successful, Err otherwise
pub fn register_virt_module(engine: &mut Engine) -> Result<(), Box<EvalAltResult>> {
// Register Buildah module functions
buildah::register_bah_module(engine)?;
// Register Nerdctl module functions
nerdctl::register_nerdctl_module(engine)?;
// Register RFS module functions
rfs::register_rfs_module(engine)?;
// Register QCOW2 module functions
qcow2::register_qcow2_module(engine)?;
// Register Cloud Hypervisor module functions
cloudhv::register_cloudhv_module(engine)?;
// Register Host dependency checker
hostcheck::register_hostcheck_module(engine)?;
// Register Image preparation functions
image_prep::register_image_prep_module(engine)?;
// Register Cloud Hypervisor builder and easy wrapper
cloudhv_builder::register_cloudhv_builder_module(engine)?;
Ok(())
}
// Re-export main functions for convenience
pub use buildah::{bah_new, register_bah_module};
pub use nerdctl::register_nerdctl_module;
pub use rfs::register_rfs_module;
pub use qcow2::register_qcow2_module;
pub use cloudhv::register_cloudhv_module;