pub enum Section<'a> {
Unchanged {
lines: Vec<Cow<'a, str>>,
},
Changed {
lines: Vec<SectionChangedLine<'a>>,
},
FileMode {
is_checked: bool,
mode: FileMode,
},
Binary {
is_checked: bool,
old_description: Option<Cow<'a, str>>,
new_description: Option<Cow<'a, str>>,
},
}
Expand description
A section of a file to be rendered and recorded.
Variants§
Unchanged
This section of the file is unchanged and just used for context.
By default, only part of the context will be shown. However, all of the context lines should be provided so that they can be used to globally number the lines correctly.
Fields
Changed
This section of the file is changed, and the user needs to select which specific changed lines to record.
Fields
lines: Vec<SectionChangedLine<'a>>
The contents of the lines, including their trailing newline character(s), if any.
FileMode
This indicates that the Unix file mode of the file changed, and that the user needs to accept that mode change or not. This is not part of the “contents” of the file per se, but it’s rendered inline as if it were.
Fields
Binary
This file contains binary contents.
Implementations§
Source§impl Section<'_>
impl Section<'_>
Sourcepub fn is_editable(&self) -> bool
pub fn is_editable(&self) -> bool
Whether or not this section contains user-editable content (as opposed to simply contextual content).
Sourcepub fn tristate(&self) -> Tristate
pub fn tristate(&self) -> Tristate
Get the tristate value of this section. If there are no items in this
section, returns Tristate::False
.
Sourcepub fn set_checked(&mut self, checked: bool)
pub fn set_checked(&mut self, checked: bool)
Select or unselect all items in this section.
Sourcepub fn toggle_all(&mut self)
pub fn toggle_all(&mut self)
Toggle the selection of this section.
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Section<'a>
impl<'de, 'a> Deserialize<'de> for Section<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<'a> Eq for Section<'a>
impl<'a> StructuralPartialEq for Section<'a>
Auto Trait Implementations§
impl<'a> Freeze for Section<'a>
impl<'a> RefUnwindSafe for Section<'a>
impl<'a> Send for Section<'a>
impl<'a> Sync for Section<'a>
impl<'a> Unpin for Section<'a>
impl<'a> UnwindSafe for Section<'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> 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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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