chore: Update generic type bounds

This commit is contained in:
Chris Hennick 2024-05-09 18:41:48 -07:00 committed by GitHub
parent e1eae16e12
commit 7ba16ae622
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -1055,13 +1055,14 @@ impl<W: Write + Seek> ZipWriter<W> {
/// same name as a file already in the archive. /// same name as a file already in the archive.
/// ///
/// The data should be written using the [`Write`] implementation on this [`ZipWriter`] /// The data should be written using the [`Write`] implementation on this [`ZipWriter`]
pub fn start_file<S, T: FileOptionExtension>( pub fn start_file<S, T: FileOptionExtension, SToOwned>(
&mut self, &mut self,
name: S, name: S,
mut options: FileOptions<T>, mut options: FileOptions<T>,
) -> ZipResult<()> ) -> ZipResult<()>
where where
S: Into<Box<str>>, S: Into<Box<str>> + ToOwned<Owned = SToOwned>,
SToOwned: Into<Box<str>>,
{ {
Self::normalize_options(&mut options); Self::normalize_options(&mut options);
let make_new_self = self.inner.prepare_next_writer( let make_new_self = self.inner.prepare_next_writer(
@ -1190,9 +1191,10 @@ impl<W: Write + Seek> ZipWriter<W> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
pub fn raw_copy_file_rename<S>(&mut self, mut file: ZipFile, name: S) -> ZipResult<()> pub fn raw_copy_file_rename<S, SToOwned>(&mut self, mut file: ZipFile, name: S) -> ZipResult<()>
where where
S: Into<Box<str>>, S: Into<Box<str>> + ToOwned<Owned = SToOwned>,
SToOwned: Into<Box<str>>,
{ {
let mut options = SimpleFileOptions::default() let mut options = SimpleFileOptions::default()
.large_file(file.compressed_size().max(file.size()) > spec::ZIP64_BYTES_THR) .large_file(file.compressed_size().max(file.size()) > spec::ZIP64_BYTES_THR)
@ -1325,14 +1327,15 @@ impl<W: Write + Seek> ZipWriter<W> {
/// implementations may materialize a symlink as a regular file, possibly with the /// implementations may materialize a symlink as a regular file, possibly with the
/// content incorrectly set to the symlink target. For maximum portability, consider /// content incorrectly set to the symlink target. For maximum portability, consider
/// storing a regular file instead. /// storing a regular file instead.
pub fn add_symlink<N, T, E: FileOptionExtension>( pub fn add_symlink<N, NToOwned, T, E: FileOptionExtension>(
&mut self, &mut self,
name: N, name: N,
target: T, target: T,
mut options: FileOptions<E>, mut options: FileOptions<E>,
) -> ZipResult<()> ) -> ZipResult<()>
where where
N: Into<Box<str>>, N: Into<Box<str>> + ToOwned<Owned = NToOwned>,
NToOwned: Into<Box<str>>,
T: Into<Box<str>>, T: Into<Box<str>>,
{ {
if options.permissions.is_none() { if options.permissions.is_none() {