gitql_ast/types/
varargs.rs

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

use super::base::DataType;

#[derive(Clone)]
pub struct VarargsType {
    pub base: Box<dyn DataType>,
}

impl DataType for VarargsType {
    fn literal(&self) -> String {
        format!("...{}", self.base.literal())
    }

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

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