gitql_ast/types/
dynamic.rs

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

use super::base::DataType;

#[derive(Clone)]
#[allow(clippy::borrowed_box)]
#[allow(clippy::type_complexity)]
pub struct DynamicType {
    pub function: fn(&[Box<dyn DataType>]) -> Box<dyn DataType>,
}

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

    fn equals(&self, _other: &Box<dyn DataType>) -> bool {
        false
    }

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