pub struct Diff {
pub id: Uuid,
pub task_id: Option<Uuid>,
pub attempt_id: Option<Uuid>,
pub baseline_id: Uuid,
pub changes: Vec<FileChange>,
pub computed_at: DateTime<Utc>,
}Expand description
A diff between two states.
Fields§
§id: UuidUnique diff ID.
task_id: Option<Uuid>Task this diff is attributed to.
attempt_id: Option<Uuid>Attempt this diff is attributed to.
baseline_id: UuidBase state (before).
changes: Vec<FileChange>File changes.
computed_at: DateTime<Utc>Computed timestamp.
Implementations§
Source§impl Diff
impl Diff
Sourcepub fn compute(baseline: &Baseline, current_root: &Path) -> Result<Self>
pub fn compute(baseline: &Baseline, current_root: &Path) -> Result<Self>
Computes a diff between a baseline and current state.
Sourcepub fn for_attempt(self, attempt_id: Uuid) -> Self
pub fn for_attempt(self, attempt_id: Uuid) -> Self
Attributes this diff to an attempt.
Sourcepub fn change_count(&self) -> usize
pub fn change_count(&self) -> usize
Returns the number of changes.
Sourcepub fn changes_of_type(&self, change_type: ChangeType) -> Vec<&FileChange>
pub fn changes_of_type(&self, change_type: ChangeType) -> Vec<&FileChange>
Returns changes of a specific type.
Sourcepub fn modified_paths(&self) -> Vec<&Path>
pub fn modified_paths(&self) -> Vec<&Path>
Returns all modified paths.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Diff
impl<'de> Deserialize<'de> for Diff
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 Diff
impl RefUnwindSafe for Diff
impl Send for Diff
impl Sync for Diff
impl Unpin for Diff
impl UnwindSafe for Diff
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.