mirror of
https://codeberg.org/Toasterson/ips.git
synced 2026-04-10 21:30:41 +00:00
fix derivable impls
Signed-off-by: Till Wegmueller <toasterson@gmail.com>
This commit is contained in:
parent
faa993ecc3
commit
a8f84ef3f6
1 changed files with 21 additions and 26 deletions
|
|
@ -3,12 +3,12 @@
|
||||||
// MPL was not distributed with this file, You can
|
// MPL was not distributed with this file, You can
|
||||||
// obtain one at https://mozilla.org/MPL/2.0/.
|
// obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
use crate::digest::{Digest, DigestAlgorithm, DigestSource, DigestError};
|
use crate::digest::{Digest, DigestAlgorithm, DigestError, DigestSource};
|
||||||
use object::Object;
|
use object::Object;
|
||||||
use std::path::Path;
|
|
||||||
use thiserror::Error;
|
|
||||||
use std::result::Result as StdResult;
|
|
||||||
use std::io::Error as IOError;
|
use std::io::Error as IOError;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::result::Result as StdResult;
|
||||||
|
use thiserror::Error;
|
||||||
|
|
||||||
type Result<T> = StdResult<T, PayloadError>;
|
type Result<T> = StdResult<T, PayloadError>;
|
||||||
|
|
||||||
|
|
@ -20,38 +20,29 @@ pub enum PayloadError {
|
||||||
DigestError(#[from] DigestError),
|
DigestError(#[from] DigestError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
pub enum PayloadCompressionAlgorithm {
|
pub enum PayloadCompressionAlgorithm {
|
||||||
Gzip,
|
Gzip,
|
||||||
LZ4
|
#[default]
|
||||||
|
LZ4,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PayloadCompressionAlgorithm {
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
fn default() -> Self { PayloadCompressionAlgorithm::LZ4 }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
|
||||||
pub enum PayloadBits {
|
pub enum PayloadBits {
|
||||||
|
#[default]
|
||||||
Independent,
|
Independent,
|
||||||
Bits32,
|
Bits32,
|
||||||
Bits64
|
Bits64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PayloadBits {
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
fn default() -> Self { PayloadBits::Independent }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
|
||||||
pub enum PayloadArchitecture {
|
pub enum PayloadArchitecture {
|
||||||
|
#[default]
|
||||||
NOARCH,
|
NOARCH,
|
||||||
I386,
|
I386,
|
||||||
SPARC,
|
SPARC,
|
||||||
ARM,
|
ARM,
|
||||||
RISCV
|
RISCV,
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for PayloadArchitecture {
|
|
||||||
fn default() -> Self { PayloadArchitecture::NOARCH }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, PartialEq, Clone)]
|
#[derive(Debug, Default, PartialEq, Clone)]
|
||||||
|
|
@ -95,11 +86,15 @@ impl Payload {
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Payload {
|
Ok(Payload {
|
||||||
primary_identifier:Digest::from_bytes(f.as_slice(), DigestAlgorithm::SHA3512, DigestSource::PrimaryPayloadHash)?,
|
primary_identifier: Digest::from_bytes(
|
||||||
|
f.as_slice(),
|
||||||
|
DigestAlgorithm::SHA3512,
|
||||||
|
DigestSource::PrimaryPayloadHash,
|
||||||
|
)?,
|
||||||
additional_identifiers: Vec::<Digest>::new(),
|
additional_identifiers: Vec::<Digest>::new(),
|
||||||
compression_algorithm: PayloadCompressionAlgorithm::default(),
|
compression_algorithm: PayloadCompressionAlgorithm::default(),
|
||||||
bitness,
|
bitness,
|
||||||
architecture
|
architecture,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue