#[non_exhaustive]pub struct CustomOperatorInfo {
pub deterministic: bool,
pub reads_context: bool,
pub min_args: usize,
pub max_args: Option<usize>,
}Expand description
What the engine may assume about a CustomOperator, returned by
CustomOperator::info.
Build one from Self::opaque or Self::pure and the with / -ing
methods; the struct is #[non_exhaustive] so fields can be added in 5.x.
use datalogic_rs::CustomOperatorInfo;
// Depends only on its one or two arguments.
let info = CustomOperatorInfo::pure().with_args(1, Some(2));
assert!(info.deterministic && !info.reads_context);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.deterministic: boolThe same arguments (and, if Self::reads_context, the same data)
always give the same result, and evaluating it has no effect the
rule could observe.
reads_context: boolReads the data context through
EvalContext, beyond its arguments.
min_args: usizeThe fewest arguments a call may pass.
max_args: Option<usize>The most arguments a call may pass, or None for no limit.
Implementations§
Source§impl CustomOperatorInfo
impl CustomOperatorInfo
Sourcepub const fn opaque() -> Self
pub const fn opaque() -> Self
Nothing assumed: nondeterministic, may read the context, any number of arguments. The default.
Sourcepub const fn pure() -> Self
pub const fn pure() -> Self
A function of its arguments alone: deterministic, reads no context, any number of arguments.
Sourcepub const fn reading_context(self) -> Self
pub const fn reading_context(self) -> Self
The same, but also reading the data context.