Struct scm_record::RecordState
source · 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 [Recorder::new
]
and then updated and returned with [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§fn eq(&self, other: &RecordState<'a>) -> bool
fn eq(&self, other: &RecordState<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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