pub struct Change {
    pub change_type: ChangeType,
    pub entity_id: EntityId,
    pub component_type: Option<ComponentTypeId>,
    pub old_value: Option<ComponentValue>,
    pub new_value: Option<ComponentValue>,
    pub rate_of_change: Option<f64>,
    pub is_unexpected: bool,
    pub timestamp: DateTime<Utc>,
}Expand description
A specific change detected between two states
Fields§
§change_type: ChangeType§entity_id: EntityId§component_type: Option<ComponentTypeId>§old_value: Option<ComponentValue>§new_value: Option<ComponentValue>§rate_of_change: Option<f64>§is_unexpected: bool§timestamp: DateTime<Utc>Implementations§
Source§impl Change
 
impl Change
Sourcepub fn new(
    change_type: ChangeType,
    entity_id: EntityId,
    component_type: Option<ComponentTypeId>,
    old_value: Option<ComponentValue>,
    new_value: Option<ComponentValue>,
) -> Self
 
pub fn new( change_type: ChangeType, entity_id: EntityId, component_type: Option<ComponentTypeId>, old_value: Option<ComponentValue>, new_value: Option<ComponentValue>, ) -> Self
Create a new change record
Sourcepub fn calculate_rate_of_change(&mut self, time_delta: Duration)
 
pub fn calculate_rate_of_change(&mut self, time_delta: Duration)
Calculate rate of change for numeric values
Sourcepub fn check_unexpected(&mut self, rules: &GameRules)
 
pub fn check_unexpected(&mut self, rules: &GameRules)
Check if this change is unexpected based on game rules
Sourcepub fn format_colored(&self) -> String
 
pub fn format_colored(&self) -> String
Format change for colored terminal output
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Change
 
impl<'de> Deserialize<'de> for Change
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 Change
impl RefUnwindSafe for Change
impl Send for Change
impl Sync for Change
impl Unpin for Change
impl UnwindSafe for Change
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