#![cfg_attr(target_os = "macos", allow(clippy::too_many_arguments))]
pub mod error;
pub mod model;
pub mod stdio;
mod store;
mod builder;
mod session;
#[cfg(target_os = "macos")]
mod bridge;
#[cfg(not(target_os = "macos"))]
mod unsupported;
pub use crate::builder::Builder;
pub use crate::error::Error;
pub use crate::model::{BootSpec, BuildPlan, BuildStep, CachePolicy, Shell};
pub use crate::session::Session;
pub use crate::stdio::{Stdio, UNATTACHED, is_tty, lend};
pub use crate::store::{
INITFS_REFERENCE, INITFS_VERSION, KERNEL_IN_ARCHIVE, KERNEL_URL, KERNEL_VERSION, Store, StoreError,
};
const FAILED: i32 = -1;
#[cfg(target_os = "macos")]
use crate::bridge::ffi;
#[cfg(not(target_os = "macos"))]
use crate::unsupported as ffi;
#[cfg(target_os = "macos")]
fn checked(code: i32, action: impl Into<String>) -> Result<i32, Error> {
if code == FAILED {
return Err(Error::failed(action, ffi::czbridge_last_error()));
}
Ok(code)
}
#[cfg(not(target_os = "macos"))]
fn checked(code: i32, action: impl Into<String>) -> Result<i32, Error> {
if code == FAILED {
return Err(Error::unavailable(action, "Containerization.framework is macOS only"));
}
Ok(code)
}