pub struct Violation {
pub constraint_name: String,
pub severity: f64,
pub explanation: String,
pub affected_entities: Vec<String>,
}Expand description
A constraint violation in solution
Fields§
§constraint_name: StringWhich constraint was violated
severity: f64Severity (0.0 = marginal, 1.0 = complete violation)
explanation: StringHuman-readable explanation
affected_entities: Vec<String>Affected entities
Implementations§
Source§impl Violation
impl Violation
Sourcepub fn new(
constraint_name: impl Into<String>,
severity: f64,
explanation: impl Into<String>,
) -> Self
pub fn new( constraint_name: impl Into<String>, severity: f64, explanation: impl Into<String>, ) -> Self
Create a new violation
Sourcepub fn with_affected(self, entity: impl Into<String>) -> Self
pub fn with_affected(self, entity: impl Into<String>) -> Self
Add affected entity
Sourcepub fn with_affected_all(
self,
entities: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_affected_all( self, entities: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Add multiple affected entities
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Violation
impl<'de> Deserialize<'de> for Violation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Violation
impl RefUnwindSafe for Violation
impl Send for Violation
impl Sync for Violation
impl Unpin for Violation
impl UnsafeUnpin for Violation
impl UnwindSafe for Violation
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