[][src]Struct qbsdiff::bsdiff::Bsdiff

pub struct Bsdiff<'s> { /* fields omitted */ }

Fast and memory saving bsdiff 4.x compatible delta compressor for execuatbles.

Source data size should not be greater than MAX_LENGTH (about 4 GiB).

Compares source with target and generates patch using the best compression level:

use std::io;
use qbsdiff::{Bsdiff, Compression};
 
fn bsdiff(source: &[u8], target: &[u8]) -> io::Result<Vec<u8>> {
    let mut patch = Vec::new();
    Bsdiff::new(source)
        .compression_level(Compression::Best)
        .compare(target, io::Cursor::new(&mut patch))?;
    Ok(patch)
}

Methods

impl<'s> Bsdiff<'s>[src]

pub fn new(source: &'s [u8]) -> Self[src]

Prepares for delta compression and immediately sorts the suffix array.

Panics if the length of source data is greater than MAX_LENGTH.

pub fn dismatch_count(self, dis: usize) -> Self[src]

Sets the threshold to determine dismatch (dis > 0, default is DISMATCH_COUNT).

pub fn compression_level(self, lv: Compression) -> Self[src]

Sets the compression level of bzip2 (default is LEVEL).

pub fn buffer_size(self, bs: usize) -> Self[src]

Sets the buffer size for delta calculation (bs >= 128, default is BUFFER_SIZE).

pub fn compare<P: Write>(&self, target: &[u8], patch: P) -> Result<u64>[src]

Starts searching matches in target and constructing the patch file.

Returns the final size of bsdiff 4.x compatible patch file.

Auto Trait Implementations

impl<'s> Send for Bsdiff<'s>

impl<'s> Sync for Bsdiff<'s>

impl<'s> Unpin for Bsdiff<'s>

impl<'s> UnwindSafe for Bsdiff<'s>

impl<'s> RefUnwindSafe for Bsdiff<'s>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]