pub struct SafetyViolation {
pub violation_id: Option<String>,
pub violation_type: Option<ViolationType>,
pub severity: Option<ViolationSeverity>,
pub description: Option<String>,
pub timestamp: Option<DateTime<Utc>>,
pub location: Option<Position2D>,
pub zone_id: Option<String>,
pub is_active: Option<bool>,
pub resolution: Option<String>,
pub resolved_at: Option<DateTime<Utc>>,
pub measured_value: Option<f64>,
pub threshold_value: Option<f64>,
}Expand description
Safety violation record.
Fields§
§violation_id: Option<String>Violation ID
violation_type: Option<ViolationType>Violation type
severity: Option<ViolationSeverity>Violation severity
description: Option<String>Description
timestamp: Option<DateTime<Utc>>Time violation occurred
location: Option<Position2D>Location where violation occurred
zone_id: Option<String>Zone ID if zone-related
is_active: Option<bool>Whether violation is still active
resolution: Option<String>Resolution action taken
resolved_at: Option<DateTime<Utc>>Resolution timestamp
measured_value: Option<f64>Measured value that caused violation
threshold_value: Option<f64>Threshold value that was exceeded
Implementations§
Source§impl SafetyViolation
impl SafetyViolation
Sourcepub fn new(
violation_type: ViolationType,
severity: ViolationSeverity,
description: impl Into<String>,
) -> Self
pub fn new( violation_type: ViolationType, severity: ViolationSeverity, description: impl Into<String>, ) -> Self
Create a new violation.
Sourcepub fn speed_exceeded(actual_mps: f64, limit_mps: f64) -> Self
pub fn speed_exceeded(actual_mps: f64, limit_mps: f64) -> Self
Create a speed violation.
Sourcepub fn proximity_violation(distance_m: f64, threshold_m: f64) -> Self
pub fn proximity_violation(distance_m: f64, threshold_m: f64) -> Self
Create a proximity violation.
Sourcepub fn with_values(self, measured: f64, threshold: f64) -> Self
pub fn with_values(self, measured: f64, threshold: f64) -> Self
Add measured and threshold values.
Sourcepub fn with_location(self, x: f64, y: f64) -> Self
pub fn with_location(self, x: f64, y: f64) -> Self
Add location.
Trait Implementations§
Source§impl Clone for SafetyViolation
impl Clone for SafetyViolation
Source§fn clone(&self) -> SafetyViolation
fn clone(&self) -> SafetyViolation
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 Debug for SafetyViolation
impl Debug for SafetyViolation
Source§impl Default for SafetyViolation
impl Default for SafetyViolation
Source§fn default() -> SafetyViolation
fn default() -> SafetyViolation
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SafetyViolation
impl<'de> Deserialize<'de> for SafetyViolation
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 SafetyViolation
impl RefUnwindSafe for SafetyViolation
impl Send for SafetyViolation
impl Sync for SafetyViolation
impl Unpin for SafetyViolation
impl UnwindSafe for SafetyViolation
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