pub struct XetFileInfo {
pub hash: String,
pub file_size: Option<u64>,
pub sha256: Option<String>,
}Expand description
A struct that wraps a the Xet file information.
Fields§
§hash: StringThe Merkle hash of the file
file_size: Option<u64>The size of the file, if known.
sha256: Option<String>The SHA-256 hash of the file, if available.
Implementations§
Source§impl XetFileInfo
impl XetFileInfo
Sourcepub fn new(hash: String, file_size: u64) -> Self
pub fn new(hash: String, file_size: u64) -> Self
Creates a new XetFileInfo instance with a known size.
§Arguments
hash- The Xet hash of the file. This is a Merkle hash string.file_size- The size of the file.
Sourcepub fn new_with_sha256(hash: String, file_size: u64, sha256: String) -> Self
pub fn new_with_sha256(hash: String, file_size: u64, sha256: String) -> Self
Creates a new XetFileInfo instance with a SHA-256 hash and known size.
Sourcepub fn new_hash_only(hash: String) -> Self
pub fn new_hash_only(hash: String) -> Self
Creates a new XetFileInfo with only a hash and no known size.
Sourcepub fn merkle_hash(&self) -> Result<MerkleHash, DataHashHexParseError>
pub fn merkle_hash(&self) -> Result<MerkleHash, DataHashHexParseError>
Returns the parsed merkle hash of the file.
pub fn as_pointer_file(&self) -> Result<String, Error>
Trait Implementations§
Source§impl Clone for XetFileInfo
impl Clone for XetFileInfo
Source§fn clone(&self) -> XetFileInfo
fn clone(&self) -> XetFileInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for XetFileInfo
impl Debug for XetFileInfo
Source§impl Default for XetFileInfo
impl Default for XetFileInfo
Source§fn default() -> XetFileInfo
fn default() -> XetFileInfo
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for XetFileInfo
impl<'de> Deserialize<'de> for XetFileInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for XetFileInfo
impl PartialEq for XetFileInfo
Source§impl Serialize for XetFileInfo
impl Serialize for XetFileInfo
impl Eq for XetFileInfo
impl StructuralPartialEq for XetFileInfo
Auto Trait Implementations§
impl Freeze for XetFileInfo
impl RefUnwindSafe for XetFileInfo
impl Send for XetFileInfo
impl Sync for XetFileInfo
impl Unpin for XetFileInfo
impl UnsafeUnpin for XetFileInfo
impl UnwindSafe for XetFileInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more