pub struct QuantileConstraint { /* private fields */ }Expand description
A unified constraint that validates quantiles and distribution properties.
This constraint replaces individual quantile constraints and provides a consistent interface for all quantile-based validations.
§Examples
use term_guard::constraints::{QuantileConstraint, QuantileMethod, Assertion};
use term_guard::core::Constraint;
// Check median (50th percentile)
let median_check = QuantileConstraint::median(
"response_time",
Assertion::LessThan(500.0)
);
// Check 95th percentile for SLA
let p95_check = QuantileConstraint::percentile(
"response_time",
0.95,
Assertion::LessThan(1000.0)
);
// Check specific quantiles using percentile method
let q25_check = QuantileConstraint::percentile(
"score",
0.25,
Assertion::GreaterThan(60.0)
);Implementations§
Source§impl QuantileConstraint
impl QuantileConstraint
Sourcepub fn with_method(
column: impl Into<String>,
validation: QuantileValidation,
method: QuantileMethod,
) -> Result<Self>
pub fn with_method( column: impl Into<String>, validation: QuantileValidation, method: QuantileMethod, ) -> Result<Self>
Creates a new unified quantile constraint with a specific method.
Sourcepub fn median(column: impl Into<String>, assertion: Assertion) -> Result<Self>
pub fn median(column: impl Into<String>, assertion: Assertion) -> Result<Self>
Convenience constructor for median check.
Sourcepub fn percentile(
column: impl Into<String>,
quantile: f64,
assertion: Assertion,
) -> Result<Self>
pub fn percentile( column: impl Into<String>, quantile: f64, assertion: Assertion, ) -> Result<Self>
Convenience constructor for percentile check.
Sourcepub fn multiple(
column: impl Into<String>,
checks: Vec<QuantileCheck>,
) -> Result<Self>
pub fn multiple( column: impl Into<String>, checks: Vec<QuantileCheck>, ) -> Result<Self>
Convenience constructor for multiple quantile checks.
Sourcepub fn distribution(
column: impl Into<String>,
config: DistributionConfig,
) -> Result<Self>
pub fn distribution( column: impl Into<String>, config: DistributionConfig, ) -> Result<Self>
Convenience constructor for distribution analysis.
Trait Implementations§
Source§impl Clone for QuantileConstraint
impl Clone for QuantileConstraint
Source§fn clone(&self) -> QuantileConstraint
fn clone(&self) -> QuantileConstraint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Constraint for QuantileConstraint
impl Constraint for QuantileConstraint
Source§fn evaluate<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
) -> Pin<Box<dyn Future<Output = Result<ConstraintResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn evaluate<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
) -> Pin<Box<dyn Future<Output = Result<ConstraintResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Evaluates the constraint against the data in the session context. Read more
Source§fn metadata(&self) -> ConstraintMetadata
fn metadata(&self) -> ConstraintMetadata
Returns the metadata associated with this constraint. Read more
Auto Trait Implementations§
impl Freeze for QuantileConstraint
impl RefUnwindSafe for QuantileConstraint
impl Send for QuantileConstraint
impl Sync for QuantileConstraint
impl Unpin for QuantileConstraint
impl UnwindSafe for QuantileConstraint
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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