pub struct RecordState<'a> {
pub is_read_only: bool,
pub commits: Vec<Commit>,
pub files: Vec<File<'a>>,
}
Expand description
The state used to render the changes. This is passed into
crate::Recorder::new
and then updated and returned with
crate::Recorder::run
.
Fields§
§is_read_only: bool
Render the UI as read-only, such that the checkbox states cannot be changed by the user.
commits: Vec<Commit>
The commits containing the selected changes. Each changed section be assigned to exactly one commit.
If there are fewer than two commits in this list, then it is padded to
two commits using Commit::default
before being returned.
It’s important to note that the Commit
s do not literally contain the
selected changes. They are stored out-of-band in the files
field. It
would be possible to store the changes in the Commit
s, but we would no
longer get the invariant that each change belongs to a single commit for
free. (That being said, we now have to uphold the invariant that the
changes are all assigned to valid commits.) It would also be somewhat
more tedious to write the code that removes the change from one Commit
and adds it to the correct relative position (with respect to all of the
other changes) in another Commit
.
files: Vec<File<'a>>
The state of each file. This is rendered in order, so you may want to sort this list by path before providing it.
Trait Implementations§
Source§impl<'a> Clone for RecordState<'a>
impl<'a> Clone for RecordState<'a>
Source§fn clone(&self) -> RecordState<'a>
fn clone(&self) -> RecordState<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> Debug for RecordState<'a>
impl<'a> Debug for RecordState<'a>
Source§impl<'a> Default for RecordState<'a>
impl<'a> Default for RecordState<'a>
Source§fn default() -> RecordState<'a>
fn default() -> RecordState<'a>
Source§impl<'de, 'a> Deserialize<'de> for RecordState<'a>
impl<'de, 'a> Deserialize<'de> for RecordState<'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>,
Source§impl<'a> PartialEq for RecordState<'a>
impl<'a> PartialEq for RecordState<'a>
Source§impl<'a> Serialize for RecordState<'a>
impl<'a> Serialize for RecordState<'a>
impl<'a> Eq for RecordState<'a>
impl<'a> StructuralPartialEq for RecordState<'a>
Auto Trait Implementations§
impl<'a> Freeze for RecordState<'a>
impl<'a> RefUnwindSafe for RecordState<'a>
impl<'a> Send for RecordState<'a>
impl<'a> Sync for RecordState<'a>
impl<'a> Unpin for RecordState<'a>
impl<'a> UnwindSafe for RecordState<'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