state: adds offset access and manipulation

pull/497/head
Christian Krause 3 years ago
parent fafad6c961
commit c2938a9b97
No known key found for this signature in database
GPG Key ID: D8A6485D41708D7B

@ -14,6 +14,16 @@ pub struct ListState {
} }
impl ListState { impl ListState {
/// Returns the offset.
pub fn offset(&self) -> usize {
self.offset
}
/// Mutably returns the offset.
pub fn offset_mut(&mut self) -> &mut usize {
&mut self.offset
}
pub fn selected(&self) -> Option<usize> { pub fn selected(&self) -> Option<usize> {
self.selected self.selected
} }

@ -342,6 +342,16 @@ pub struct TableState {
} }
impl TableState { impl TableState {
/// Returns the offset.
pub fn offset(&self) -> usize {
self.offset
}
/// Mutably returns the offset.
pub fn offset_mut(&mut self) -> &mut usize {
&mut self.offset
}
pub fn selected(&self) -> Option<usize> { pub fn selected(&self) -> Option<usize> {
self.selected self.selected
} }

Loading…
Cancel
Save