Debian Codegraph @

src/base/read/io/combined_record.rs

raw symbols SCIP
1 // Copyright (c) 2023 Harry [Majored] [[email protected]]
2 // Copyright (c) 2023 Cognite AS
3 // MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE)
4
5 use craterust-analyzer cargo async_zip 0.0.18 crate/::specrust-analyzer cargo async_zip 0.0.18 spec/::headerrust-analyzer cargo async_zip 0.0.18 spec/header/::{EndOfCentralDirectoryHeaderrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#, Zip64EndOfCentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#};
6
7 /// Combines all the fields in EOCDR and Zip64EOCDR into one struct.
8 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
9 pub struct CombinedCentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord# {
10 pub version_made_byrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#version_made_by.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u16>,
11 pub version_needed_to_extractrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#version_needed_to_extract.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u16>,
12 pub disk_numberrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#disk_number.: u32,
13 pub disk_number_start_of_cdrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#disk_number_start_of_cd.: u32,
14 pub num_entries_in_directory_on_diskrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#num_entries_in_directory_on_disk.: u64,
15 pub num_entries_in_directoryrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#num_entries_in_directory.: u64,
16 pub directory_sizerust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#directory_size.: u64,
17 pub offset_of_start_of_directoryrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#offset_of_start_of_directory.: u64,
18 pub file_comment_lengthrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#file_comment_length.: u16,
19 }
20
21 impl CombinedCentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord# {
22 /// Combine an EOCDR with an optional Zip64EOCDR.
23 ///
24 /// Fields that are set to their max value in the EOCDR will be overwritten by the contents of
25 /// the corresponding Zip64EOCDR field.
26 pub fn combinerust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/impl#[CombinedCentralDirectoryRecord]combine().(eocdr: EndOfCentralDirectoryHeaderrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#, zip64eocdr: Zip64EndOfCentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#) -> Selfrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/impl#[CombinedCentralDirectoryRecord] {
27 let mut combined = Selfrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/impl#[CombinedCentralDirectoryRecord]::fromrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/impl#[CombinedCentralDirectoryRecord][`From<&EndOfCentralDirectoryHeader>`]from().(&eocdr);
28 if eocdr.disk_numrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#disk_num. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX. {
29 combined.disk_numberrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#disk_number. = zip64eocdr.disk_numberrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#disk_number.;
30 }
31 if eocdr.start_cent_dir_diskrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#start_cent_dir_disk. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX. {
32 combined.disk_number_start_of_cdrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#disk_number_start_of_cd. = zip64eocdr.disk_number_start_of_cdrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#disk_number_start_of_cd.;
33 }
34 if eocdr.num_of_entries_diskrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#num_of_entries_disk. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX. {
35 combined.num_entries_in_directory_on_diskrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#num_entries_in_directory_on_disk. = zip64eocdr.num_entries_in_directory_on_diskrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#num_entries_in_directory_on_disk.;
36 }
37 if eocdr.num_of_entriesrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#num_of_entries. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialEq<Self>`]eq().u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX. {
38 combined.num_entries_in_directoryrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#num_entries_in_directory. = zip64eocdr.num_entries_in_directoryrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#num_entries_in_directory.;
39 }
40 if eocdr.size_cent_dirrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#size_cent_dir. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().u32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]MAX. {
41 combined.directory_sizerust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#directory_size. = zip64eocdr.directory_sizerust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#directory_size.;
42 }
43 if eocdr.cent_dir_offsetrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#cent_dir_offset. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialEq<Self>`]eq().u32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]MAX. {
44 combined.offset_of_start_of_directoryrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#offset_of_start_of_directory. = zip64eocdr.offset_of_start_of_directoryrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#offset_of_start_of_directory.;
45 }
46 combined.version_made_byrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#version_made_by. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(zip64eocdr.version_made_byrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#version_made_by.);
47 combined.version_needed_to_extractrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#version_needed_to_extract. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(zip64eocdr.version_needed_to_extractrust-analyzer cargo async_zip 0.0.18 spec/header/Zip64EndOfCentralDirectoryRecord#version_needed_to_extract.);
48
49 combined
50 }
51 }
52
53 // An implementation for the case of no zip64EOCDR.
54 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&EndOfCentralDirectoryHeaderrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#> for CombinedCentralDirectoryRecordrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord# {
55 fn fromrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/impl#[CombinedCentralDirectoryRecord][`From<&EndOfCentralDirectoryHeader>`]from().(header: &EndOfCentralDirectoryHeaderrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#) -> Selfrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/impl#[CombinedCentralDirectoryRecord][`From<&EndOfCentralDirectoryHeader>`] {
56 Selfrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/impl#[CombinedCentralDirectoryRecord][`From<&EndOfCentralDirectoryHeader>`] {
57 version_made_byrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#version_made_by.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
58 version_needed_to_extractrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#version_needed_to_extract.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
59 disk_numberrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#disk_number.: header.disk_numrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#disk_num. as u32,
60 disk_number_start_of_cdrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#disk_number_start_of_cd.: header.start_cent_dir_diskrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#start_cent_dir_disk. as u32,
61 num_entries_in_directory_on_diskrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#num_entries_in_directory_on_disk.: header.num_of_entries_diskrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#num_of_entries_disk. as u64,
62 num_entries_in_directoryrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#num_entries_in_directory.: header.num_of_entriesrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#num_of_entries. as u64,
63 directory_sizerust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#directory_size.: header.size_cent_dirrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#size_cent_dir. as u64,
64 offset_of_start_of_directoryrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#offset_of_start_of_directory.: header.cent_dir_offsetrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#cent_dir_offset. as u64,
65 file_comment_lengthrust-analyzer cargo async_zip 0.0.18 base/read/io/combined_record/CombinedCentralDirectoryRecord#file_comment_length.: header.file_comm_lengthrust-analyzer cargo async_zip 0.0.18 spec/header/EndOfCentralDirectoryHeader#file_comm_length.,
66 }
67 }
68 }