pub struct Resource<'a> {
pub driver_index: Option<usize>,
pub data: Data<'a>,
pub mode: EntryKind,
pub rela_path: &'a BStr,
pub id: &'a oid,
}
blob
only.Expand description
A resource ready to be diffed in one way or another.
Fields§
§driver_index: Option<usize>
If available, an index into the drivers
field to access more diff-related information of the driver for items
at the given path, as previously determined by git-attributes.
Note that drivers are queried even if there is no object available.
data: Data<'a>
The data itself, suitable for diffing, and if the object or worktree item is present at all.
mode: EntryKind
The kind of the resource we are looking at. Only possible values are Blob
, BlobExecutable
and Link
.
rela_path: &'a BStr
The location of the resource, relative to the working tree.
id: &'a oid
The id of the content as it would be stored in git
, or null
if the content doesn’t exist anymore at
rela_path
or if it was never computed. This can happen with content read from the worktree, which has to
go through a filter to be converted back to what git
would store.
Implementations§
Source§impl<'a> Resource<'a>
impl<'a> Resource<'a>
Sourcepub fn intern_source(&self) -> ByteLines<'a, true> ⓘ
pub fn intern_source(&self) -> ByteLines<'a, true> ⓘ
Produce an iterator over lines, separated by LF or CRLF and thus keeping newlines.
Note that this will cause unusual diffs if a file didn’t end in newline but lines were added on the other side.
Suitable to create tokens using imara_diff::intern::InternedInput
.
Sourcepub fn intern_source_strip_newline_separators(&self) -> ByteLines<'a, false> ⓘ
pub fn intern_source_strip_newline_separators(&self) -> ByteLines<'a, false> ⓘ
Produce an iterator over lines, but remove LF or CRLF.
This produces the expected diffs when lines were added at the end of a file that didn’t end with a newline before the change.
Suitable to create tokens using imara_diff::intern::InternedInput
.
Trait Implementations§
Source§impl<'a> Ord for Resource<'a>
impl<'a> Ord for Resource<'a>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a> PartialOrd for Resource<'a>
impl<'a> PartialOrd for Resource<'a>
impl<'a> Copy for Resource<'a>
impl<'a> Eq for Resource<'a>
impl<'a> StructuralPartialEq for Resource<'a>
Auto Trait Implementations§
impl<'a> Freeze for Resource<'a>
impl<'a> RefUnwindSafe for Resource<'a>
impl<'a> Send for Resource<'a>
impl<'a> Sync for Resource<'a>
impl<'a> Unpin for Resource<'a>
impl<'a> UnwindSafe for Resource<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.