pub trait StateCommon {
type ModelType;
type TagType: ToString;
type KeyType: Clone;
// Required methods
fn get_filter_info(&self) -> &Option<(Self::TagType, String)>;
fn get_tag_from_tab_idx(&self, tab: &str, idx: usize) -> Self::TagType;
fn get_model(&self) -> Ref<'_, Self::ModelType>;
fn get_model_mut(&self) -> RefMut<'_, Self::ModelType>;
fn new(model: Rc<RefCell<Self::ModelType>>) -> Self;
// Provided methods
fn is_filter_supported_from_tab_idx(&self, _tab: &str, _idx: usize) -> bool { ... }
fn set_filter_from_tab_idx(
&mut self,
_tab: &str,
_idx: usize,
_filter: Option<String>,
) -> bool { ... }
fn set_sort_tag(&mut self, _tag: Self::TagType, _reverse: &mut bool) -> bool { ... }
fn set_sort_string(&mut self, _selection: &str, _reverse: &mut bool) -> bool { ... }
fn set_sort_tag_from_tab_idx(
&mut self,
_tab: &str,
_idx: usize,
_reverse: &mut bool,
) -> bool { ... }
}Expand description
A trait that defines common state data querying or event handling.
This trait must be implemented by all view state. It will help to expose state data to the StatsView for common behavior. On the other hand, it force a view to have required data in order to fit itself inside the StatsView.
Required Associated Types§
Required Methods§
Sourcefn get_filter_info(&self) -> &Option<(Self::TagType, String)>
fn get_filter_info(&self) -> &Option<(Self::TagType, String)>
Expose filter data for StatsView to set fields in filter popup
Sourcefn get_tag_from_tab_idx(&self, tab: &str, idx: usize) -> Self::TagType
fn get_tag_from_tab_idx(&self, tab: &str, idx: usize) -> Self::TagType
Gets the FieldId associated with given tab and column index
fn get_model(&self) -> Ref<'_, Self::ModelType>
fn get_model_mut(&self) -> RefMut<'_, Self::ModelType>
fn new(model: Rc<RefCell<Self::ModelType>>) -> Self
Provided Methods§
Sourcefn is_filter_supported_from_tab_idx(&self, _tab: &str, _idx: usize) -> bool
fn is_filter_supported_from_tab_idx(&self, _tab: &str, _idx: usize) -> bool
Returns true iff filtering is supported for column
Sourcefn set_filter_from_tab_idx(
&mut self,
_tab: &str,
_idx: usize,
_filter: Option<String>,
) -> bool
fn set_filter_from_tab_idx( &mut self, _tab: &str, _idx: usize, _filter: Option<String>, ) -> bool
Set the filter (current column and filter string) Return true on success, false on failure
Sourcefn set_sort_tag(&mut self, _tag: Self::TagType, _reverse: &mut bool) -> bool
fn set_sort_tag(&mut self, _tag: Self::TagType, _reverse: &mut bool) -> bool
Set the sorting tag to common state Return true on success, false if current tab doest support sorting.
fn set_sort_string(&mut self, _selection: &str, _reverse: &mut bool) -> bool
fn set_sort_tag_from_tab_idx( &mut self, _tab: &str, _idx: usize, _reverse: &mut bool, ) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".