pub struct Distinfo { /* private fields */ }Expand description
Distinfo contains the contents of a distinfo file.
The primary interface for populating a Distinfo from an existing
distinfo file is using the from_bytes function. There is no error
handling. Any input that is unrecognised or not in the correct format is
simply ignored.
To create a new distinfo file, use new and set the fields manually.
Implementations§
Source§impl Distinfo
impl Distinfo
Sourcepub fn rcsid(&self) -> Option<&OsString>
pub fn rcsid(&self) -> Option<&OsString>
Return an Option containing either a valid $NetBSD: ... RCS Id
line, or None if one was not found.
Sourcepub fn patchfiles(&self) -> Vec<&Entry>
pub fn patchfiles(&self) -> Vec<&Entry>
Return a Vec of references to patchfile entries, if any.
Sourcepub fn calculate_size<P: AsRef<Path>>(path: P) -> Result<u64, DistinfoError>
pub fn calculate_size<P: AsRef<Path>>(path: P) -> Result<u64, DistinfoError>
Calculate size of a PathBuf.
Sourcepub fn calculate_checksum<P: AsRef<Path>>(
path: P,
digest: Digest,
) -> Result<String, DistinfoError>
pub fn calculate_checksum<P: AsRef<Path>>( path: P, digest: Digest, ) -> Result<String, DistinfoError>
Sourcepub fn find_entry<P: AsRef<Path>>(
&self,
path: P,
) -> Result<&Entry, DistinfoError>
pub fn find_entry<P: AsRef<Path>>( &self, path: P, ) -> Result<&Entry, DistinfoError>
Find an Entry in the current Distinfo given a Path.
Distinfo distfile entries may include a directory component
(DIST_SUBDIR) so applications can’t simply look up by filename.
This function iterates over the Path in reverse, adding any leading
components until an entry is found, or returns
DistinfoError::NotFound.
Sourcepub fn verify_size<P: AsRef<Path>>(&self, path: P) -> Result<u64, DistinfoError>
pub fn verify_size<P: AsRef<Path>>(&self, path: P) -> Result<u64, DistinfoError>
Pass the full path to a file to check as a PathBuf and verify that
it matches the size stored in the Distinfo.
Returns the size if Ok, otherwise return a DistinfoError.
Sourcepub fn verify_checksum<P: AsRef<Path>>(
&self,
path: P,
digest: Digest,
) -> Result<Digest, DistinfoError>
pub fn verify_checksum<P: AsRef<Path>>( &self, path: P, digest: Digest, ) -> Result<Digest, DistinfoError>
Pass the full path to a file to check as a PathBuf and verify that
it matches a specific Digest checksum stored in the Distinfo.
Return the Digest if Ok, otherwise return a DistinfoError.
To verify all stored checksums use use verify_checksums.
Sourcepub fn verify_checksums<P: AsRef<Path>>(
&self,
path: P,
) -> Vec<Result<Digest, DistinfoError>>
pub fn verify_checksums<P: AsRef<Path>>( &self, path: P, ) -> Vec<Result<Digest, DistinfoError>>
Sourcepub fn from_bytes(bytes: &[u8]) -> Distinfo
pub fn from_bytes(bytes: &[u8]) -> Distinfo
Trait Implementations§
impl Eq for Distinfo
impl StructuralPartialEq for Distinfo
Auto Trait Implementations§
impl Freeze for Distinfo
impl RefUnwindSafe for Distinfo
impl Send for Distinfo
impl Sync for Distinfo
impl Unpin for Distinfo
impl UnwindSafe for Distinfo
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.