Full read-write operations on the working copy. This trait extends `WorkingCopyRead` with methods for modifying the working copy: creating files, deleting files, renaming, etc. # Thread Safety Working copy operations are typically not thread-safe. Use appropriate synchronization if accessing from multiple threads.
| 312 | /// Working copy operations are typically not thread-safe. Use appropriate |
| 313 | /// synchronization if accessing from multiple threads. |
| 314 | pub trait WorkingCopy: WorkingCopyRead { |
| 315 | /// The writer type returned by `write_file`. |
| 316 | type Writer: Write; |
| 317 | |
| 318 | /// Check if a path is writable. |
| 319 | /// |
| 320 | /// This can be used to skip files that should not be modified, |
| 321 | /// such as those with special attributes or user-specified exclusions. |
| 322 | /// |
| 323 | /// # Arguments |
| 324 | /// |
| 325 | /// * `path` - Relative path within the working copy |
| 326 | /// |
| 327 | /// # Returns |
| 328 | /// |
| 329 | /// `true` if the file can be written, `false` if it should be skipped. |
| 330 | fn is_writable(&self, _path: &str) -> Result<bool, Self::Error> { |
| 331 | Ok(true) |
| 332 | } |
| 333 | |
| 334 | /// Create a directory and all parent directories. |
| 335 | /// |
| 336 | /// # Arguments |
| 337 | /// |
| 338 | /// * `path` - Relative path of the directory to create |
| 339 | /// |
| 340 | /// # Returns |
| 341 | /// |
| 342 | /// `Ok(())` on success (including if the directory already exists). |
| 343 | fn create_dir_all(&self, path: &str) -> Result<(), Self::Error>; |
| 344 | |
| 345 | /// Remove a file or directory. |
| 346 | /// |
| 347 | /// # Arguments |
| 348 | /// |
| 349 | /// * `path` - Relative path to remove |
| 350 | /// * `recursive` - If true and path is a directory, remove contents recursively |
| 351 | /// |
| 352 | /// # Returns |
| 353 | /// |
| 354 | /// `Ok(())` on success. May return an error if the path doesn't exist |
| 355 | /// or cannot be removed. |
| 356 | fn remove_path(&self, path: &str, recursive: bool) -> Result<(), Self::Error>; |
| 357 | |
| 358 | /// Rename or move a file/directory. |
| 359 | /// |
| 360 | /// # Arguments |
| 361 | /// |
| 362 | /// * `from` - Current relative path |
| 363 | /// * `to` - New relative path |
| 364 | /// |
| 365 | /// # Returns |
| 366 | /// |
| 367 | /// `Ok(())` on success. May return an error if the source doesn't exist |
| 368 | /// or the destination cannot be written. |
| 369 | fn rename(&self, from: &str, to: &str) -> Result<(), Self::Error>; |
| 370 | |
| 371 | /// Set file permissions. |
no outgoing calls
no test coverage detected