pub struct ChangeRecord {
pub operation: String,
pub timestamp: String,
pub base_dir: String,
pub options: Option<Value>,
pub changes: Vec<Change>,
}Expand description
Record of all changes from a refactoring operation
Fields§
§operation: StringName of the operation (e.g., “group”, “rename_files”)
timestamp: StringISO 8601 timestamp of when the operation occurred
base_dir: StringBase directory where the operation was performed (absolute path)
options: Option<Value>Options used for the operation (operation-specific)
changes: Vec<Change>List of changes made
Implementations§
Source§impl ChangeRecord
impl ChangeRecord
Sourcepub fn with_options<T: Serialize>(self, options: &T) -> Self
pub fn with_options<T: Serialize>(self, options: &T) -> Self
Sets the options for this operation
Sourcepub fn add_directory_created(&mut self, path: &str)
pub fn add_directory_created(&mut self, path: &str)
Adds a directory creation change
Sourcepub fn add_file_moved(&mut self, from: &str, to: &str)
pub fn add_file_moved(&mut self, from: &str, to: &str)
Adds a file move change
Sourcepub fn add_file_renamed(&mut self, from: &str, to: &str, directory: &str)
pub fn add_file_renamed(&mut self, from: &str, to: &str, directory: &str)
Adds a file rename change
Sourcepub fn file_moves(&self) -> Vec<(&str, &str)>
pub fn file_moves(&self) -> Vec<(&str, &str)>
Returns only the file move changes
Sourcepub fn write_to_file(&self, path: &Path) -> Result<()>
pub fn write_to_file(&self, path: &Path) -> Result<()>
Writes the change record to a JSON file
Sourcepub fn read_from_file(path: &Path) -> Result<Self>
pub fn read_from_file(path: &Path) -> Result<Self>
Reads a change record from a JSON file
Trait Implementations§
Source§impl Clone for ChangeRecord
impl Clone for ChangeRecord
Source§fn clone(&self) -> ChangeRecord
fn clone(&self) -> ChangeRecord
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 ChangeRecord
impl Debug for ChangeRecord
Source§impl<'de> Deserialize<'de> for ChangeRecord
impl<'de> Deserialize<'de> for ChangeRecord
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 ChangeRecord
impl RefUnwindSafe for ChangeRecord
impl Send for ChangeRecord
impl Sync for ChangeRecord
impl Unpin for ChangeRecord
impl UnsafeUnpin for ChangeRecord
impl UnwindSafe for ChangeRecord
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