Trait for archive implementations. This trait abstracts over different archive formats, allowing the same archive logic to work with tarballs, zip files, or directories.
| 653 | /// This trait abstracts over different archive formats, allowing |
| 654 | /// the same archive logic to work with tarballs, zip files, or directories. |
| 655 | pub trait Archive { |
| 656 | /// The file writer type for this archive. |
| 657 | type Writer: Write; |
| 658 | |
| 659 | /// Error type for this archive. |
| 660 | type Error: std::error::Error + 'static; |
| 661 | |
| 662 | /// Create a new file in the archive. |
| 663 | fn create_file( |
| 664 | &mut self, |
| 665 | path: &str, |
| 666 | size: u64, |
| 667 | mode: u32, |
| 668 | mtime: u64, |
| 669 | ) -> Result<Self::Writer, Self::Error>; |
| 670 | |
| 671 | /// Create a directory in the archive. |
| 672 | fn create_directory(&mut self, path: &str, mode: u32, mtime: u64) -> Result<(), Self::Error>; |
| 673 | |
| 674 | /// Close a file writer. |
| 675 | fn close_file(&mut self, writer: Self::Writer) -> Result<(), Self::Error>; |
| 676 | |
| 677 | /// Finish writing the archive. |
| 678 | fn finish(self) -> Result<(), Self::Error>; |
| 679 | } |
| 680 | |
| 681 | // Directory Archive |
| 682 |
no outgoing calls
no test coverage detected