mod cmd;
mod container;
mod container_builder;
mod container_functions;
mod container_operations;
#[cfg(test)]
mod container_test;
mod container_types;
mod health_check;
mod health_check_script;
mod images;
use std::error::Error;
use std::fmt;
use std::io;
#[derive(Debug)]
pub enum NerdctlError {
CommandExecutionFailed(io::Error),
CommandFailed(String),
JsonParseError(String),
ConversionError(String),
Other(String),
}
impl fmt::Display for NerdctlError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
NerdctlError::CommandExecutionFailed(e) => {
write!(f, "Failed to execute nerdctl command: {}", e)
}
NerdctlError::CommandFailed(e) => write!(f, "Nerdctl command failed: {}", e),
NerdctlError::JsonParseError(e) => write!(f, "Failed to parse JSON: {}", e),
NerdctlError::ConversionError(e) => write!(f, "Conversion error: {}", e),
NerdctlError::Other(e) => write!(f, "{}", e),
}
}
}
impl Error for NerdctlError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
match self {
NerdctlError::CommandExecutionFailed(e) => Some(e),
_ => None,
}
}
}
pub use cmd::*;
pub use container_functions::*;
pub use container_types::{Container, ContainerStatus, HealthCheck, ResourceUsage};
pub use health_check_script::*;
pub use images::*;