Skip to main content

MergeChunk

Struct MergeChunk 

Source
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: usize

base 侧起始行号(1-based)

§ours_start: usize

本地侧起始行号(1-based)

§theirs_start: usize

远端侧起始行号(1-based)

Implementations§

Source§

impl MergeChunk

Source

pub fn ours_lines(&self) -> &[String]

本地侧行内容;稳定块双方与 base 一致,共用 base 的存储 (避免整个文件的稳定区内容被复制三份)。

Source

pub fn theirs_lines(&self) -> &[String]

远端侧行内容;稳定块双方与 base 一致,共用 base 的存储。

Trait Implementations§

Source§

impl Clone for MergeChunk

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for MergeChunk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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

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.