pub struct FileState<'a> {
pub file_mode: Option<usize>,
pub sections: Vec<Section<'a>>,
}
Expand description
The state of a file to be recorded.
Fields§
§file_mode: Option<usize>
The Unix file mode of the file, if available.
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 Section
s inside the file.
Implementations§
Source§impl FileState<'_>
impl FileState<'_>
Sourcepub fn count_changed_sections(&self) -> usize
pub fn count_changed_sections(&self) -> usize
Count the number of changed sections in this file.
Sourcepub fn get_file_mode(&self) -> Option<usize>
pub fn get_file_mode(&self) -> Option<usize>
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) -> (String, String)
pub fn get_selected_contents(&self) -> (String, String)
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.