diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-04-29 16:27:23 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-04-29 16:27:23 +0530 |
| commit | bf531facb0349c528f6f8965d05257a46a7f3fd3 (patch) | |
| tree | 1f0c80bd822bd7eaeb15c8921bd6286091821b68 /src/list.rs | |
| parent | c61b0503c7b9f112a72829004ea5308083f39185 (diff) | |
add metadata in queue list
Diffstat (limited to 'src/list.rs')
| -rwxr-xr-x | src/list.rs | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/list.rs b/src/list.rs index 6294f44..219b9a4 100755 --- a/src/list.rs +++ b/src/list.rs @@ -14,30 +14,36 @@ impl<T> ContentList<T> { // Go to next item in list pub fn next(&mut self) { - // if self.index < self.list.len() - 1 { - // self.index += 1; - // } - let len = self.list.len(); if len != 0 { - if self.index == self.list.len() - 1 { - self.index = 0; - } else { + if self.index < len - 1 { self.index += 1; } } + + // let len = self.list.len(); + // if len != 0 { + // if self.index == self.list.len() - 1 { + // self.index = 0; + // } else { + // self.index += 1; + // } + // } } /// Go to previous item in list pub fn prev(&mut self) { - if self.index == 0 { - let len = self.list.len(); - if len != 0 { - self.index = len - 1; - } - } else { + if self.index != 0 { self.index -= 1; } + // if self.index == 0 { + // let len = self.list.len(); + // if len != 0 { + // self.index = len - 1; + // } + // } else { + // self.index -= 1; + // } } pub fn reset_index(&mut self) { |
