Skip to content

Commit b4cb039

Browse files
committed
docs: add comments to Bookmarked functions
This pr add simple comments in the Bookmarked functions improving its documentation. Signed-off-by: JGBSouza <joaosouzaaa12@usp.br>
1 parent 9f77c75 commit b4cb039

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/app/screens/bookmarked.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
11
use crate::lore::patch::Patch;
22

33
pub struct BookmarkedPatchsets {
4+
/// List of all bookmarked patchsets
45
pub bookmarked_patchsets: Vec<Patch>,
6+
/// Index of the currently selected patchset
57
pub patchset_index: usize,
68
}
79

810
impl BookmarkedPatchsets {
11+
/// Increments `patchset_index` by one, unless the last patchset
12+
/// is already selected.
913
pub fn select_below_patchset(&mut self) {
1014
if self.patchset_index + 1 < self.bookmarked_patchsets.len() {
1115
self.patchset_index += 1;
1216
}
1317
}
1418

19+
/// Decrements `patchset_index` by one, unless the first patchset
20+
// is alredy selected.
1521
pub fn select_above_patchset(&mut self) {
1622
self.patchset_index = self.patchset_index.saturating_sub(1);
1723
}
1824

25+
/// Get a clone of the actual selected patchset
1926
pub fn get_selected_patchset(&self) -> Patch {
2027
self.bookmarked_patchsets
2128
.get(self.patchset_index)
2229
.unwrap()
2330
.clone()
2431
}
2532

33+
/// Add a patchset to the list of bookmarks if is not already on the list
2634
pub fn bookmark_selected_patch(&mut self, patch_to_bookmark: &Patch) {
2735
if !self.bookmarked_patchsets.contains(patch_to_bookmark) {
2836
self.bookmarked_patchsets.push(patch_to_bookmark.clone());
2937
}
3038
}
3139

40+
/// Remove a patchset from the list of bookmarks
3241
pub fn unbookmark_selected_patch(&mut self, patch_to_unbookmark: &Patch) {
3342
if let Some(index) = self
3443
.bookmarked_patchsets

0 commit comments

Comments
 (0)