pub struct MergeChunk {
pub id: usize,
pub kind: ChunkKind,
pub base: Vec<String>,
pub ours: Vec<String>,
pub theirs: Vec<String>,
pub base_start: usize,
pub ours_start: usize,
pub theirs_start: usize,
}Expand description
一个合并块:base 的某个连续区间以及双方在该区间的内容。
Fields§
§id: usize块序号,供交互层定位操作
kind: ChunkKind块类型
base: Vec<String>base 在该区间的行内容(已去行尾换行)
ours: Vec<String>本地侧在该区间的行内容;稳定块不重复存储(为空),
读取应使用 Self::ours_lines
theirs: Vec<String>远端侧在该区间的行内容;稳定块不重复存储(为空),
读取应使用 Self::theirs_lines
base_start: usizebase 侧起始行号(1-based)
ours_start: usize本地侧起始行号(1-based)
theirs_start: usize远端侧起始行号(1-based)
Implementations§
Source§impl MergeChunk
impl MergeChunk
Sourcepub fn ours_lines(&self) -> &[String]
pub fn ours_lines(&self) -> &[String]
本地侧行内容;稳定块双方与 base 一致,共用 base 的存储 (避免整个文件的稳定区内容被复制三份)。
Sourcepub fn theirs_lines(&self) -> &[String]
pub fn theirs_lines(&self) -> &[String]
远端侧行内容;稳定块双方与 base 一致,共用 base 的存储。
Trait Implementations§
Source§impl Clone for MergeChunk
impl Clone for MergeChunk
Source§fn clone(&self) -> MergeChunk
fn clone(&self) -> MergeChunk
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MergeChunk
impl RefUnwindSafe for MergeChunk
impl Send for MergeChunk
impl Sync for MergeChunk
impl Unpin for MergeChunk
impl UnsafeUnpin for MergeChunk
impl UnwindSafe for MergeChunk
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more