1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors
use std::any::Any;
use crate::expr::Arity;
use crate::expr::ChildName;
use crate::expr::ExprVTable;
/// Information about the signature of an expression.
pub struct ExpressionSignature<'a> {
pub(super) vtable: &'a ExprVTable,
pub(super) options: &'a dyn Any,
}
impl ExpressionSignature<'_> {
/// Returns the arity of this expression.
pub fn arity(&self) -> Arity {
self.vtable.as_dyn().arity(self.options)
}
/// Returns the name of the nth child of this expression.
pub fn child_name(&self, index: usize) -> ChildName {
self.vtable.as_dyn().child_name(self.options, index)
}
/// Returns whether this expression itself is null-sensitive.
/// See [`crate::expr::VTable::is_null_sensitive`].
pub fn is_null_sensitive(&self) -> bool {
self.vtable.as_dyn().is_null_sensitive(self.options)
}
/// Returns whether this expression itself is fallible.
/// See [`crate::expr::VTable::is_fallible`].
pub fn is_fallible(&self) -> bool {
self.vtable.as_dyn().is_fallible(self.options)
}
}