@@ -21,7 +21,7 @@ use indexmap::{IndexMap, IndexSet};
2121use lzzzz:: { lz4, lz4_hc} ;
2222use thiserror:: Error ;
2323
24- /// `PackageResourceBlob` is an enum representing various types of package resource stores, which can
24+ /// `PackageResourceBlob` is an enum representing various types of package resource stores, which can
2525/// include files, file sections, and memory buffers, optionally compressed or scrambled.
2626enum PackageResourceBlob {
2727 File {
@@ -450,8 +450,8 @@ impl PackageBuilder {
450450 Self {
451451 partition_id : PartitionId {
452452 part_type : match chunk_type {
453- ChunkType :: Standard => { PartitionType :: Standard }
454- ChunkType :: Addon => { PartitionType :: Addon }
453+ ChunkType :: Standard => PartitionType :: Standard ,
454+ ChunkType :: Addon => PartitionType :: Addon ,
455455 } ,
456456 index : chunk_id as usize ,
457457 } ,
@@ -467,10 +467,7 @@ impl PackageBuilder {
467467 /// # Arguments
468468 /// * `partition_id` - The partition id of the package.
469469 /// * `patch_id` - The patch id of the package.
470- pub fn new_with_patch_id (
471- partition_id : PartitionId ,
472- patch_id : PatchId ,
473- ) -> Self {
470+ pub fn new_with_patch_id ( partition_id : PartitionId , patch_id : PatchId ) -> Self {
474471 Self {
475472 partition_id,
476473 patch_id,
@@ -498,9 +495,10 @@ impl PackageBuilder {
498495 . metadata
499496 . as_ref ( )
500497 . map ( |m| m. chunk_type )
501- . unwrap_or_default ( ) {
502- ChunkType :: Standard => { PartitionType :: Standard }
503- ChunkType :: Addon => { PartitionType :: Addon }
498+ . unwrap_or_default ( )
499+ {
500+ ChunkType :: Standard => PartitionType :: Standard ,
501+ ChunkType :: Addon => PartitionType :: Addon ,
504502 } ,
505503 index : resource_package
506504 . metadata
@@ -512,9 +510,10 @@ impl PackageBuilder {
512510 . metadata
513511 . as_ref ( )
514512 . map ( |m| m. patch_id )
515- . unwrap_or_default ( ) {
513+ . unwrap_or_default ( )
514+ {
516515 0 => PatchId :: Base ,
517- x => PatchId :: Patch ( x as usize )
516+ x => PatchId :: Patch ( x as usize ) ,
518517 } ,
519518 use_legacy_references : false ,
520519 resources : IndexMap :: new ( ) ,
@@ -533,7 +532,7 @@ impl PackageBuilder {
533532 resource. compressed_size ( ) ,
534533 resource. is_scrambled ( ) ,
535534 )
536- . map_err ( |e| PackageBuilderError :: CannotDuplicateResource ( * rrid, e) ) ?
535+ . map_err ( |e| PackageBuilderError :: CannotDuplicateResource ( * rrid, e) ) ?
537536 }
538537
539538 ResourcePackageSource :: Memory ( source_data) => {
@@ -557,7 +556,7 @@ impl PackageBuilder {
557556 decompressed_size,
558557 resource. is_scrambled ( ) ,
559558 )
560- . map_err ( |e| PackageBuilderError :: CannotDuplicateResource ( * rrid, e) ) ?
559+ . map_err ( |e| PackageBuilderError :: CannotDuplicateResource ( * rrid, e) ) ?
561560 }
562561 } ;
563562
@@ -625,7 +624,7 @@ impl PackageBuilder {
625624 data : & T ,
626625 ) -> Result < ( ) , PackageBuilderError >
627626 where
628- for < ' a > T :: Args < ' a > : Required ,
627+ for < ' a > T :: Args < ' a > : Required ,
629628 {
630629 let current_offset = writer
631630 . stream_position ( )
@@ -813,12 +812,12 @@ impl PackageBuilder {
813812 unknown : 1 ,
814813 chunk_id : self . partition_id . index as u8 ,
815814 chunk_type : match self . partition_id . part_type {
816- PartitionType :: Addon => { ChunkType :: Addon }
817- _ => { ChunkType :: Standard }
815+ PartitionType :: Addon => ChunkType :: Addon ,
816+ _ => ChunkType :: Standard ,
818817 } ,
819818 patch_id : match self . patch_id {
820- PatchId :: Base => { 0 }
821- PatchId :: Patch ( x) => { x as u8 }
819+ PatchId :: Base => 0 ,
820+ PatchId :: Patch ( x) => x as u8 ,
822821 } ,
823822 language_tag : * b"xx" ,
824823 } ) ,
@@ -839,7 +838,8 @@ impl PackageBuilder {
839838 . map_err ( PackageBuilderError :: SerializationError ) ?;
840839
841840 let offset_table_result = self . write_offset_table ( writer) ?;
842- let metadata_table_result = self . write_metadata_table ( writer, self . use_legacy_references ) ?;
841+ let metadata_table_result =
842+ self . write_metadata_table ( writer, self . use_legacy_references ) ?;
843843
844844 // Now that we're done writing the tables, let's patch the header.
845845 header. header . offset_table_size = offset_table_result. offset_table_size ;
@@ -1014,8 +1014,8 @@ impl PackageBuilder {
10141014 output_path : & Path ,
10151015 ) -> Result < ( ) , PackageBuilderError > {
10161016 let output_file = match output_path. is_dir ( ) {
1017- true => { output_path. join ( self . partition_id . to_filename ( self . patch_id ) ) }
1018- false => { output_path. to_path_buf ( ) }
1017+ true => output_path. join ( self . partition_id . to_filename ( self . patch_id ) ) ,
1018+ false => output_path. to_path_buf ( ) ,
10191019 } ;
10201020
10211021 let mut file = File :: create ( output_file) . map_err ( PackageBuilderError :: IoError ) ?;
@@ -1028,10 +1028,7 @@ impl PackageBuilder {
10281028 /// * `version` - The version of the package to build.
10291029 /// * `is_patch` - Whether the package is a patch package.
10301030 /// * `legacy_references` - Whether to use the legacy references format.
1031- pub fn build_in_memory (
1032- self ,
1033- version : PackageVersion ,
1034- ) -> Result < Vec < u8 > , PackageBuilderError > {
1031+ pub fn build_in_memory ( self , version : PackageVersion ) -> Result < Vec < u8 > , PackageBuilderError > {
10351032 let mut writer = Cursor :: new ( vec ! [ ] ) ;
10361033 self . build_internal ( version, & mut writer) ?;
10371034 Ok ( writer. into_inner ( ) )
0 commit comments