[−][src]Struct sfv::Sfv
Fields
files: BTreeMap<PathBuf, Vec<u8>>
The file paths and their checksums/hashes
Implementations
impl Sfv
[src]
pub fn new() -> Self
[src]
Create a new, empty Sfv object
pub fn from_sfv<P: AsRef<Path>, S: AsRef<str>>(
base_directory: P,
sfv: S
) -> Result<Self, ()>
[src]
base_directory: P,
sfv: S
) -> Result<Self, ()>
Convert a SFV file in string format to a Sfv object.
use sfv::Sfv; use std::collections::BTreeMap; use std::path::PathBuf; let sfv_file = r#" ; This is a comment file_one.zip c45ad668 file_two.zip 7903b8e6 file_three.zip e99a65fb "#; let sfv = Sfv::from_sfv("/test", sfv_file).unwrap(); assert_eq!( *sfv.files.get(&PathBuf::from("/test/file_one.zip")).unwrap(), vec![0xc4, 0x5a, 0xd6, 0x68] )
pub fn add_file<P: AsRef<Path>, D: AsRef<[u8]>>(&mut self, path: P, data: D)
[src]
Adds a file and checksum entry to the Sfv.
use sfv::Sfv; use std::path::PathBuf; let mut sfv = Sfv::new(); let path = PathBuf::from("/test.txt"); let checksum: Vec<u8> = vec![0x42, 0x42, 0x42, 0x42]; sfv.add_file(&path, &checksum); assert_eq!( *sfv.files.get(&PathBuf::from("/test.txt")).unwrap(), vec![0x42, 0x42, 0x42, 0x42] )
Trait Implementations
impl Clone for Sfv
[src]
impl Debug for Sfv
[src]
impl Default for Sfv
[src]
impl Display for Sfv
[src]
impl Eq for Sfv
[src]
impl Ord for Sfv
[src]
fn cmp(&self, other: &Sfv) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Sfv> for Sfv
[src]
impl PartialOrd<Sfv> for Sfv
[src]
fn partial_cmp(&self, other: &Sfv) -> Option<Ordering>
[src]
fn lt(&self, other: &Sfv) -> bool
[src]
fn le(&self, other: &Sfv) -> bool
[src]
fn gt(&self, other: &Sfv) -> bool
[src]
fn ge(&self, other: &Sfv) -> bool
[src]
impl StructuralEq for Sfv
[src]
impl StructuralPartialEq for Sfv
[src]
Auto Trait Implementations
impl RefUnwindSafe for Sfv
impl Send for Sfv
impl Sync for Sfv
impl Unpin for Sfv
impl UnwindSafe for Sfv
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,