refactor: Make new method unsafe

This commit is contained in:
Chris Hennick 2024-05-01 14:32:40 -07:00
parent 69e7397011
commit 8040a044c3
No known key found for this signature in database
GPG key ID: DA47AABA4961C509

View file

@ -654,9 +654,9 @@ impl<W: Write + Seek> ZipWriter<W> {
/// Set the file length and crc32 manually. /// Set the file length and crc32 manually.
/// ///
/// WARNING: This overwrites the internal crc32 calculation. It should only be used in case /// SAFETY: This overwrites the internal crc32 calculation. It should only be used in case
/// the underlying [Write] is written independently and you need to adjust the zip metadata. /// the underlying [Write] is written independently and you need to adjust the zip metadata.
pub fn set_file_metadata(&mut self, length: u64, crc32: u32) -> ZipResult<()> { pub unsafe fn set_file_metadata(&mut self, length: u64, crc32: u32) -> ZipResult<()> {
if !self.writing_to_file { if !self.writing_to_file {
return Err(ZipError::Io(io::Error::new( return Err(ZipError::Io(io::Error::new(
io::ErrorKind::Other, io::ErrorKind::Other,