use crate::config::{
rt::{RtcBuilder, RtcCore},
Clean, Configuration,
};
use std::ops::Deref;
#[derive(Clone, Debug)]
pub struct RtcClean {
pub core: RtcCore,
pub cargo: bool,
pub tools: bool,
}
impl Deref for RtcClean {
type Target = RtcCore;
fn deref(&self) -> &Self::Target {
&self.core
}
}
#[derive(Clone, Debug)]
pub struct CleanOptions {
pub core: super::CoreOptions,
pub tools: bool,
}
impl RtcClean {
pub(crate) fn new(config: Configuration, opts: CleanOptions) -> anyhow::Result<Self> {
let CleanOptions {
core: core_opts,
tools,
} = opts;
#[allow(deprecated)]
let Configuration {
core: core_config,
clean:
Clean {
cargo,
dist: _,
},
..
} = config;
let core = RtcCore::new(core_config, core_opts)?;
Ok(Self { core, cargo, tools })
}
}
impl RtcBuilder for RtcClean {
type Options = CleanOptions;
async fn build(configuration: Configuration, options: Self::Options) -> anyhow::Result<Self> {
Self::new(configuration, options)
}
}