use crate::dtype::DType;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Scope {
root: DType,
}
impl Scope {
pub fn new(root: DType) -> Self {
Self { root }
}
pub fn root(&self) -> &DType {
&self.root
}
}
impl From<DType> for Scope {
fn from(root: DType) -> Self {
Self::new(root)
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::dtype::Nullability;
#[test]
fn root_round_trips() {
let dtype = DType::Bool(Nullability::Nullable);
assert_eq!(Scope::new(dtype.clone()).root(), &dtype);
assert_eq!(Scope::from(dtype.clone()).root(), &dtype);
}
}