Struct scm_record::File
source · pub struct File<'a> {
pub old_path: Option<Cow<'a, Path>>,
pub path: Cow<'a, Path>,
pub file_mode: Option<FileMode>,
pub sections: Vec<Section<'a>>,
}Expand description
The state of a file to be recorded.
Fields§
§old_path: Option<Cow<'a, Path>>The path to the previous version of the file, for display purposes. This should be set if the file was renamed or copied from another file.
path: Cow<'a, Path>The path to the current version of the file, for display purposes.
file_mode: Option<FileMode>The Unix file mode of the file (before any changes), if available. This may be rendered by the UI.
This value is not directly modified by the UI; instead, construct a
Section::FileMode and use the [FileState::get_file_mode] function
to read a user-provided updated to the file mode function to read a
user-provided updated to the file mode.
sections: Vec<Section<'a>>The set of Sections inside the file.
Implementations§
source§impl File<'_>
impl File<'_>
sourcepub fn get_file_mode(&self) -> Option<FileMode>
pub fn get_file_mode(&self) -> Option<FileMode>
Get the new Unix file mode. If the user selected a
Section::FileMode, then returns that file mode. Otherwise, returns
the file_mode value that this [FileState] was constructed with.
sourcepub fn get_selected_contents(
&self
) -> (SelectedContents<'_>, SelectedContents<'_>)
pub fn get_selected_contents( &self ) -> (SelectedContents<'_>, SelectedContents<'_>)
Calculate the (selected, unselected) contents of the file. For
example, the first value would be suitable for staging or committing,
and the second value would be suitable for potentially recording again.
sourcepub fn tristate(&self) -> Tristate
pub fn tristate(&self) -> Tristate
Get the tristate value of the file. If there are no sections in this
file, returns Tristate::False.
sourcepub fn set_checked(&mut self, checked: bool)
pub fn set_checked(&mut self, checked: bool)
Set the selection of all sections and lines in this file.
sourcepub fn toggle_all(&mut self)
pub fn toggle_all(&mut self)
Toggle the selection of all sections in this file.