Struct rdiff::Diff
[−]
[src]
pub struct Diff { /* fields omitted */ }
Represents a series of operations that were performed on a file to transform it into a new version.
The operations are stored in file order, which means that every operation that affects an earlier part of the file must be stored before an operation that affects a later part. The diff also assumes that insert operations are performed prior to delete operations.
Methods
impl Diff
[src]
fn new() -> Diff
Creates a new Diff
fn inserts(&self) -> Iter<Insert>
Gets an iterator over all insert operations
fn deletes(&self) -> Iter<Delete>
Gets an iterator over all delete operations
fn is_empty(&self) -> bool
Checks if this set of diffs has any actual content
fn apply_to_string(&self, string: &str) -> Result<String, FromUtf8Error>
Applies all of the operations in the diff to the given string. Gives an error if the resulting string can't be represented by utf8.
Panics
When the operations refer to positions that are not represented by the string.
fn apply(&self, file: &mut File) -> Result<()>
Apply the operations in this sequence to a file. This should not be called until after
the sequence has been integrated via Engine::integrate_remote
The file must have been opened on both read and write mode (see OpenOptions).
fn compress_to<W: Write>(&self, writer: &mut W) -> Result<()>
Compress this diff and write to writer
. The output can then be expanded
back into an equivilent Diff using expand_from()
fn expand_from<R: Read>(reader: &mut R) -> Result<Diff>
Expand this diff from previously compressed data in reader
. The data in reader
should have been written using compress_to()