[go: up one dir, main page]

Struct Platform

Source
pub struct Platform<'a> {
    pub resource_cache: &'a mut Platform,
}
Available on crate feature blob-diff only.
Expand description

A platform to keep temporary information to perform line diffs on modified blobs.

Fields§

§resource_cache: &'a mut Platform

The cache holding diffable data related to our blobs.

Implementations§

Source§

impl Platform<'_>

Source

pub fn lines<FnH, E>( &mut self, process_hunk: FnH, ) -> Result<Outcome<'_>, Error<E>>
where FnH: FnMut(Change<'_, '_>) -> Result<(), E>, E: Error + Send + Sync + 'static,

Perform a diff on lines between the old and the new version of a blob, passing each hunk of lines to process_hunk. The diffing algorithm is determined by the diff.algorithm configuration, or individual diff drivers. Note that process_hunk is not called if one of the involved resources are binary, but that can be determined by introspecting the outcome.

Source

pub fn line_counts(&mut self) -> Result<Option<Counter<()>>, Error>

Count the amount of removed and inserted lines efficiently. Note that nothing will happen if one of the inputs is binary, and None will be returned.

Auto Trait Implementations§

§

impl<'a> Freeze for Platform<'a>

§

impl<'a> RefUnwindSafe for Platform<'a>

§

impl<'a> Send for Platform<'a>

§

impl<'a> Sync for Platform<'a>

§

impl<'a> Unpin for Platform<'a>

§

impl<'a> !UnwindSafe for Platform<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,