pub trait ViewBridge {
type StateType: Default + StateCommon;
// Required methods
fn get_view_name() -> &'static str;
fn get_titles(&self) -> ColumnTitles;
fn get_rows(
&mut self,
state: &Self::StateType,
offset: Option<usize>,
) -> Vec<(StyledString, <<Self as ViewBridge>::StateType as StateCommon>::KeyType)>;
// Provided methods
fn on_select_update_state(
_state: &mut Self::StateType,
_selected_key: Option<&<<Self as ViewBridge>::StateType as StateCommon>::KeyType>,
) { ... }
fn on_select_update_cmd_palette(
_state: &Self::StateType,
_selected_key: &<<Self as ViewBridge>::StateType as StateCommon>::KeyType,
_current_tab: &str,
_selected_column: usize,
) -> String { ... }
}Expand description
ViewBridge defines how a ConcreteView will relate to StatsView
Required Associated Types§
type StateType: Default + StateCommon
Required Methods§
Sourcefn get_view_name() -> &'static str
fn get_view_name() -> &'static str
Return the name of the view, this function will help StatsView to query view by name.
Sourcefn get_titles(&self) -> ColumnTitles
fn get_titles(&self) -> ColumnTitles
Return the column titles of the view
Sourcefn get_rows(
&mut self,
state: &Self::StateType,
offset: Option<usize>,
) -> Vec<(StyledString, <<Self as ViewBridge>::StateType as StateCommon>::KeyType)>
fn get_rows( &mut self, state: &Self::StateType, offset: Option<usize>, ) -> Vec<(StyledString, <<Self as ViewBridge>::StateType as StateCommon>::KeyType)>
The essential function that defines how a StatsView should fill the data. This function will iterate through the data, apply filter and sorting, return a Vec of (Stats String Line, Key) tuple.
§Arguments
state: The concrete view stateoffset: Indicates how many columns we should pass after the first column when generating a line.
Provided Methods§
Sourcefn on_select_update_state(
_state: &mut Self::StateType,
_selected_key: Option<&<<Self as ViewBridge>::StateType as StateCommon>::KeyType>,
)
fn on_select_update_state( _state: &mut Self::StateType, _selected_key: Option<&<<Self as ViewBridge>::StateType as StateCommon>::KeyType>, )
Optional callback called by on_select of inner SelectView and on refresh for updating state based on selected key.
Sourcefn on_select_update_cmd_palette(
_state: &Self::StateType,
_selected_key: &<<Self as ViewBridge>::StateType as StateCommon>::KeyType,
_current_tab: &str,
_selected_column: usize,
) -> String
fn on_select_update_cmd_palette( _state: &Self::StateType, _selected_key: &<<Self as ViewBridge>::StateType as StateCommon>::KeyType, _current_tab: &str, _selected_column: usize, ) -> String
Optional callback called by on_select of inner SelectView for updating command palette. Returns info String set on the palette.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".