fn start_entry<S>(
        &mut self,
        name: S,
        options: FileOptions,
        raw_values: Option<ZipRawValues>,
    ) -> ZipResult<()>
    where
        S: Into<String>,
    {
        self.finish_file()?;

        let is_raw = raw_values.is_some();
        let raw_values = raw_values.unwrap_or_else(|| ZipRawValues {
            crc32: 0,
            compressed_size: 0,
            uncompressed_size: 0,
        });

        {
            let writer = self.inner.get_plain();
            let header_start = writer.seek(io::SeekFrom::Current(0))?;

            let permissions = options.permissions.unwrap_or(0o100644);
            let mut file = ZipFileData {
                system: System::Unix,
                version_made_by: DEFAULT_VERSION,
                encrypted: false,
                compression_method: options.compression_method,
                last_modified_time: options.last_modified_time,
                crc32: raw_values.crc32,
                compressed_size: raw_values.compressed_size,
                uncompressed_size: raw_values.uncompressed_size,
                file_name: name.into(),
                file_name_raw: Vec::new(), // Never used for saving
                file_comment: String::new(),
                header_start,
                data_start: 0,
                central_header_start: 0,
                external_attributes: permissions << 16,
            };
            write_local_file_header(writer, &file)?;

            let header_end = writer.seek(io::SeekFrom::Current(0))?;
            self.stats.start = header_end;
            file.data_start = header_end;

            self.stats.bytes_written = 0;
            self.stats.hasher = Hasher::new();

            self.files.push(file);
        }

        self.writing_raw = is_raw;
        self.inner.switch_to(if is_raw {
            CompressionMethod::Stored
        } else {
            options.compression_method
        })?;

        Ok(())
    }
/// Start a new file for with the requested options.
Start a new file for with the requested options.
Start a new file for with the requested options .
fn start_entry<S>(
        &mut self,
        name: S,
        options: FileOptions,
        raw_values: Option<ZipRawValues>,
    ) -> ZipResult<()>
    where
        S: Into<String>,
    {
        self.finish_file()?;
        let is_raw = raw_values.is_some();
        let raw_values = raw_values.unwrap_or_else(|| ZipRawValues {
            crc32: 0,
            compressed_size: 0,
            uncompressed_size: 0,
        });
        {
            let writer = self.inner.get_plain();
            let header_start = writer.seek(io::SeekFrom::Current(0))?;
            let permissions = options.permissions.unwrap_or(0o100644);
            let mut file = ZipFileData {
                system: System::Unix,
                version_made_by: DEFAULT_VERSION,
                encrypted: false,
                compression_method: options.compression_method,
                last_modified_time: options.last_modified_time,
                crc32: raw_values.crc32,
                compressed_size: raw_values.compressed_size,
                uncompressed_size: raw_values.uncompressed_size,
                file_name: name.into(),
                file_name_raw: Vec::new(), // Never used for saving
                file_comment: String::new(),
                header_start,
                data_start: 0,
                central_header_start: 0,
                external_attributes: permissions << 16,
            };
            write_local_file_header(writer, &file)?;
            let header_end = writer.seek(io::SeekFrom::Current(0))?;
            self.stats.start = header_end;
            file.data_start = header_end;
            self.stats.bytes_written = 0;
            self.stats.hasher = Hasher::new();
            self.files.push(file);
        }
        self.writing_raw = is_raw;
        self.inner.switch_to(if is_raw {
            CompressionMethod::Stored
        } else {
            options.compression_method
        })?;
        Ok(())
    }
fn start_entry < S > ( & mut self , name : S , options : FileOptions , raw_values : Option < ZipRawValues > , ) -> ZipResult < ( ) > where S : Into < String > , { self . finish_file ( ) ? ; let is_raw = raw_values . is_some ( ) ; let raw_values = raw_values . unwrap_or_else ( | | ZipRawValues { crc32 : 0 , compressed_size : 0 , uncompressed_size : 0 , } ) ; { let writer = self . inner . get_plain ( ) ; let header_start = writer . seek ( io :: SeekFrom :: Current ( 0 ) ) ? ; let permissions = options . permissions . unwrap_or ( 0o100644 ) ; let mut file = ZipFileData { system : System :: Unix , version_made_by : DEFAULT_VERSION , encrypted : false , compression_method : options . compression_method , last_modified_time : options . last_modified_time , crc32 : raw_values . crc32 , compressed_size : raw_values . compressed_size , uncompressed_size : raw_values . uncompressed_size , file_name : name . into ( ) , file_name_raw : Vec :: new ( ) , // Never used for saving file_comment : String :: new ( ) , header_start , data_start : 0 , central_header_start : 0 , external_attributes : permissions << 16 , } ; write_local_file_header ( writer , & file ) ? ; let header_end = writer . seek ( io :: SeekFrom :: Current ( 0 ) ) ? ; self . stats . start = header_end ; file . data_start = header_end ; self . stats . bytes_written = 0 ; self . stats . hasher = Hasher :: new ( ) ; self . files . push ( file ) ; } self . writing_raw = is_raw ; self . inner . switch_to ( if is_raw { CompressionMethod :: Stored } else { options . compression_method } ) ? ; Ok ( ( ) ) }
Start a new file for with the requested options.
Start a new file for with the requested options .
&mut self
name
S
options
FileOptions
raw_values
Option<ZipRawValues>
&mut self
name
S
options
FileOptions
raw_values
Option<ZipRawValues>