Skip to main content

FilterViolation

Enum FilterViolation 

Source
pub enum FilterViolation {
    NotConformed,
    Failed(Error),
}
Expand description

The outcome of re-checking a filter against a value a relationship’s method derived, rather than a value written externally.

See crate::sheet::Sheet::filter_violation.

§Examples

use adam_rs::{Filter, FilterViolation, Method, Sheet};
let mut sheet = Sheet::new();
let input = sheet.add_source(20_i32);
let output = sheet.add_cell(0_i32);
sheet.add_filter(output, Filter::from_fn_0(|v: &i32| Ok((*v).min(10))))?;
sheet.add_relationship(vec![Method::from_fn_1_1(input, output, |v: &i32| Ok(*v))])?;
sheet.propagate()?;
assert!(matches!(sheet.filter_violation(output), Some(FilterViolation::NotConformed)));
assert_eq!(*sheet.read::<i32>(output)?, 20);

Variants§

§

NotConformed

The filter succeeded but its output differs from the cell’s current value. Only ever recorded for a derived cell (Sheet::propagate’s post-execution diagnostic phase) — a filtered source cell’s filter output is unconditionally authoritative once computed (see PlanStep::FilterReclamp), so this variant never applies there.

§

Failed(Error)

The filter’s function itself returned an error, or returned a value of a different type than the cell — both treated as an equally soft diagnostic (see the design spec §4 for why a filter’s own Err is not a propagation-aborting failure the way a Requirement’s is). Can occur on either side: a derived cell’s read-only diagnostic check, or a source cell’s live reclamp, in which case the cell’s stored value is left unchanged.

Trait Implementations§

Source§

impl Debug for FilterViolation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.