bluejay_core/executable/
variable_definition.rs

1use crate::executable::VariableType;
2use crate::{AsIter, ConstDirectives, ConstValue};
3
4pub trait VariableDefinition {
5    type VariableType: VariableType;
6    type Directives: ConstDirectives;
7    type Value: ConstValue;
8
9    fn variable(&self) -> &str;
10    fn r#type(&self) -> &Self::VariableType;
11    fn directives(&self) -> Option<&Self::Directives>;
12    fn default_value(&self) -> Option<&Self::Value>;
13
14    fn is_required(&self) -> bool {
15        self.default_value().is_none() && self.r#type().as_ref().is_required()
16    }
17}
18
19pub trait VariableDefinitions: AsIter<Item = Self::VariableDefinition> {
20    type VariableDefinition: VariableDefinition;
21}