pub mod parfile;
pub mod parblock;
use std::path::{PathBuf};
use std::result;
use std::str::FromStr;
use crate::options::Opts;
use crate::errors::{Result, XcpError};
pub trait CopyDriver {
fn supported_platform(&self) -> bool;
fn copy_all(&self, sources: Vec<PathBuf>, dest: PathBuf, opts: &Opts) -> Result<()>;
fn copy_single(&self, source: &PathBuf, dest: PathBuf, opts: &Opts) -> Result<()>;
}
#[derive(Debug, Clone, Copy)]
pub enum Drivers {
ParFile,
ParBlock,
}
impl FromStr for Drivers {
type Err = XcpError;
fn from_str(s: &str) -> result::Result<Self, Self::Err> {
match s {
"parfile" => Ok(Drivers::ParFile),
"parblock" => Ok(Drivers::ParBlock),
_ => Err(XcpError::UnknownDriver(s.to_owned()).into()),
}
}
}