1- use std:: marker:: PhantomData ;
2-
31use egui:: { Color32 , RichText } ;
42use strum:: { EnumIter , VariantNames } ;
53use telemetry:: Metric ;
@@ -214,8 +212,6 @@ pub trait Constraint {
214212
215213 fn evaluation_as_string ( & self ) -> String ;
216214
217- // fn as_string(&self, _backend: &Backend) -> String;
218-
219215 fn implies < C : Constraint > ( self , rhs : C ) -> ImpliesConstraint < Self , C >
220216 where
221217 Self : Sized ,
@@ -362,25 +358,8 @@ impl<C1: Constraint, C2: Constraint> Constraint for ImpliesConstraint<C1, C2> {
362358 return !self . lhs . check ( ) || self . rhs . check ( ) ;
363359 }
364360 fn evaluation_as_string ( & self ) -> String {
365- // if self.check() {
366- // format! {"({}) implies ({})", self.lhs.evaluation_as_string(), self.rhs.evaluation_as_string()}
367- // } else {
368361 format ! { "({}) while ({})" , self . rhs. evaluation_as_string( ) , self . lhs. evaluation_as_string( ) }
369- //}
370- // if self.check() {
371- // format! {"({}) => ({})", self.lhs.evaluation_as_string(), self.rhs.evaluation_as_string()}
372- // } else {
373- // format! {"!({}) while ({})", self.rhs.evaluation_as_string(), self.lhs.evaluation_as_string()}
374- // }
375362 }
376-
377- // fn as_string(&self, backend: &Backend) -> String {
378- // format!("({}) => ({})", self.lhs.as_string(backend), self.rhs.as_string(backend))
379- // }
380-
381- // fn violation_reason(&self, backend: &Backend) -> String {
382- // format!("{} && Condition is true", self.rhs.violation_reason(backend))
383- // }
384363}
385364
386365#[ derive( Default ) ]
@@ -400,22 +379,8 @@ impl<C: Constraint> Constraint for NotConstraint<C> {
400379 }
401380
402381 fn evaluation_as_string ( & self ) -> String {
403- // if self.check() {
404- // format!("is not {}", self.constraint.evaluation_as_string())
405- // } else {
406- // format!("is {}", self.constraint.evaluation_as_string())
407- //}
408382 self . constraint . evaluation_as_string ( )
409- //format!("{}{}", if self.check() { "!" } else { "" }, self.constraint.evaluation_as_string())
410383 }
411-
412- // fn as_string(&self, backend: &Backend) -> String {
413- // format!("!({})", self.constraint.as_string(backend))
414- // }
415-
416- // fn violation_reason(&self, backend: &Backend) -> String {
417- // format!("!{}", self.constraint.violation_reason(backend))
418- // }
419384}
420385
421386pub struct GreaterOrEqualConstraint < M : MetricTrait , C : ConstraintValue < Type = M :: Value > > {
@@ -443,21 +408,7 @@ impl<M: MetricTrait, C: ConstraintValue<Type = M::Value>> Constraint for Greater
443408 } else {
444409 format ! ( "below {}" , constraint_str)
445410 }
446- // format!(
447- // "{} {} {}",
448- // self.cached_metric.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
449- // if self.check() { ">=" } else { "<" },
450- // self.cached_constraint.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
451- // )
452411 }
453-
454- // fn as_string(&self, backend: &Backend) -> String {
455- // format!("{:?} >= {}", M::metric(), self.value.as_string(backend))
456- // }
457-
458- // fn violation_reason(&self, backend: &Backend) -> String {
459- // format!("< {}", self.value.as_string(backend))
460- // }
461412}
462413
463414pub struct GreaterThanConstraint < M : MetricTrait , C : ConstraintValue < Type = M :: Value > > {
@@ -485,21 +436,7 @@ impl<M: MetricTrait, C: ConstraintValue<Type = M::Value>> Constraint for Greater
485436 } else {
486437 format ! ( "below {}" , constraint_str)
487438 }
488- // format!(
489- // "{} {} {}",
490- // self.cached_metric.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
491- // if self.check() { ">" } else { "<=" },
492- // self.cached_constraint.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
493- // )
494439 }
495-
496- // fn as_string(&self, backend: &Backend) -> String {
497- // format!("{:?} > {}", M::metric(), self.value.as_string(backend))
498- // }
499-
500- // fn violation_reason(&self, backend: &Backend) -> String {
501- // format!("<= {}", self.value.as_string(backend))
502- // }
503440}
504441
505442pub struct LessOrEqualConstraint < M : MetricTrait , C : ConstraintValue < Type = M :: Value > > {
@@ -527,21 +464,7 @@ impl<M: MetricTrait, C: ConstraintValue<Type = M::Value>> Constraint for LessOrE
527464 } else {
528465 format ! ( "exceeds {}" , constraint_str)
529466 }
530- // format!(
531- // "{} {} {}",
532- // self.cached_metric.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
533- // if self.check() { "<=" } else { ">" },
534- // self.cached_constraint.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
535- // )
536467 }
537-
538- // fn as_string(&self, backend: &Backend) -> String {
539- // format!("{:?} <= {}", M::metric(), self.value.as_string(backend))
540- // }
541-
542- // fn violation_reason(&self, backend: &Backend) -> String {
543- // format!("> {}", self.value.as_string(backend))
544- // }
545468}
546469
547470pub struct LessThanConstraint < M : MetricTrait , C : ConstraintValue < Type = M :: Value > > {
@@ -569,21 +492,7 @@ impl<M: MetricTrait, C: ConstraintValue<Type = M::Value>> Constraint for LessTha
569492 } else {
570493 format ! ( "exceeds {}" , constraint_str)
571494 }
572- // format!(
573- // "{} {} {}",
574- // self.cached_metric.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
575- // if self.check() { "<" } else { ">=" },
576- // self.cached_constraint.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
577- // )
578495 }
579-
580- // fn as_string(&self, backend: &Backend) -> String {
581- // format!("{:?} < {}", M::metric(), self.value.as_string(backend))
582- // }
583-
584- // fn violation_reason(&self, backend: &Backend) -> String {
585- // format!(">= {}", self.value.as_string(backend))
586- // }
587496}
588497
589498pub struct SomeConstraint < M : MetricTrait > {
@@ -607,20 +516,7 @@ impl<M: MetricTrait> Constraint for SomeConstraint<M> {
607516 } else {
608517 format ! ( "is N/A" )
609518 }
610- // format!(
611- // "{} {} Some",
612- // self.cached_metric.cached_result.as_ref().map(|_| "Some").unwrap_or("N/A"),
613- // if self.check() { "==" } else { "!=" }
614- // )
615519 }
616-
617- // fn as_string(&self, _backend: &Backend) -> String {
618- // format!("{:?} is Some", M::metric())
619- // }
620-
621- // fn violation_reason(&self, _backend: &Backend) -> String {
622- // "N/A".to_string()
623- // }
624520}
625521
626522pub struct EqualsConstraint < M : MetricTrait , C : ConstraintValue < Type = M :: Value > > {
@@ -649,18 +545,4 @@ impl<M: MetricTrait, C: ConstraintValue<Type = M::Value>> Constraint for EqualsC
649545 format ! ( "is not {}" , constraint_str)
650546 }
651547 }
652- // format!(
653- // "{} {} {}",
654- // self.cached_metric.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
655- // if self.check() { "==" } else { "!=" },
656- // self.cached_constraint.cached_result.as_ref().map(|v| v.to_string()).unwrap_or("N/A".to_string()),
657- // )
658- // }
659- // fn as_string(&self, backend: &Backend) -> String {
660- // format!("{:?} == {}", M::metric(), self.value.as_string(backend))
661- // }
662-
663- // fn violation_reason(&self, backend: &Backend) -> String {
664- // format!("!= {}", self.value.as_string(backend))
665- // }
666548}
0 commit comments