gitql_ast/types/
null.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::any::Any;

use super::base::DataType;

#[derive(Clone)]
pub struct NullType;

impl DataType for NullType {
    fn literal(&self) -> String {
        "Null".to_string()
    }

    fn equals(&self, other: &Box<dyn DataType>) -> bool {
        other.is_any() || other.is_null() || other.is_variant_with(|t| t.is_null())
    }

    fn as_any(&self) -> &dyn Any {
        self
    }
}