use std::fmt::Debug;
#[derive(PartialEq, Clone, Copy)]
pub struct Deps<T>(Option<T>);
impl<T: Debug> Debug for Deps<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut result = f.debug_tuple("Deps");
match self.0.as_ref() {
Some(deps) => result.field(&deps),
None => result.field(&"All"),
}
.finish()
}
}
impl Deps<()> {
pub fn all() -> Self {
Self(None)
}
pub fn none() -> Self {
Self(Some(()))
}
}
impl<T> Deps<T> {
pub fn some(deps: T) -> Self {
Self(Some(deps))
}
pub(crate) fn is_all(&self) -> bool {
self.0.is_none()
}
}