pub struct SourceFileDiffs {
    pub(crate) bytes_per_diff: usize,
    pub(crate) num_diffs: usize,
    pub(crate) raw_diffs: Vec<u8>,
}
Expand description

The source file lines in difference list form. This matches the form used within metadata, which saves space by exploiting the fact that the lines list is sorted and individual lines are usually not that long.

We read it directly from metadata and only decode it into Lines form when necessary. This is a significant performance win, especially for small crates where very little of std’s metadata is used.

Fields§

§bytes_per_diff: usize

Always 1, 2, or 4. Always as small as possible, while being big enough to hold the length of the longest line in the source file. The 1 case is by far the most common.

§num_diffs: usize

The number of diffs encoded in raw_diffs. Always one less than the number of lines in the source file.

§raw_diffs: Vec<u8>

The diffs in “raw” form. Each segment of bytes_per_diff length encodes one little-endian diff. Note that they aren’t LEB128 encoded. This makes for much faster decoding. Besides, the bytes_per_diff==1 case is by far the most common, and LEB128 encoding has no effect on that case.

Trait Implementations§

source§

impl Clone for SourceFileDiffs

source§

fn clone(&self) -> SourceFileDiffs

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 40 bytes