pub struct TensorRuleValidator {
pub config: ValidatorConfig,
pub registered_heads: HashMap<String, u64>,
}Expand description
Validates RuleSpec instances before they are committed to the
knowledge base.
Fields§
§config: ValidatorConfigValidation policy settings.
registered_heads: HashMap<String, u64>Maps a head signature (head_terms joined with "|") to the
rule_id of the rule that first registered it.
Implementations§
Source§impl TensorRuleValidator
impl TensorRuleValidator
Sourcepub fn new(config: ValidatorConfig) -> Self
pub fn new(config: ValidatorConfig) -> Self
Creates a new validator with the supplied configuration.
Sourcepub fn validate(&mut self, spec: &RuleSpec) -> ValidationResult
pub fn validate(&mut self, spec: &RuleSpec) -> ValidationResult
Validates spec and returns a ValidationResult describing every
error and warning found. When the result contains no errors the head
signature is automatically registered so that subsequent duplicate
checks can detect it.
Sourcepub fn registered_count(&self) -> usize
pub fn registered_count(&self) -> usize
Returns how many valid rules have been registered.
Sourcepub fn clear_registry(&mut self)
pub fn clear_registry(&mut self)
Removes all previously registered head signatures.
Auto Trait Implementations§
impl Freeze for TensorRuleValidator
impl RefUnwindSafe for TensorRuleValidator
impl Send for TensorRuleValidator
impl Sync for TensorRuleValidator
impl Unpin for TensorRuleValidator
impl UnsafeUnpin for TensorRuleValidator
impl UnwindSafe for TensorRuleValidator
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more