pub trait Application {
// Required methods
fn get_env_var(&self, var_name: &str) -> Option<String>;
fn set_title(&self, title: &str);
fn set_main_widget(&mut self, widget: Box<dyn Widget>);
fn get_resource_path(&self, link: &str) -> String;
fn add_data_processor_shared(&mut self, dp: Arc<RwLock<dyn DataProcessor>>);
fn widget_generator(&mut self) -> &mut dyn WidgetGenerator;
fn open(&self, path: &str, data: &str) -> Result<(), CallError>;
fn get_launch_string(&self) -> Result<String, CallError>;
// Provided method
fn get_host(&self) -> String { ... }
}
Expand description
The trait represents cross platform abstraction of a UiPage
For the most cases it’ll represent a highest level UI element such as window for desktop, activity for Android, tab for browser, etc.
Required Methods§
Sourcefn get_env_var(&self, var_name: &str) -> Option<String>
fn get_env_var(&self, var_name: &str) -> Option<String>
Get value for environment vairable by variable name
Sourcefn set_main_widget(&mut self, widget: Box<dyn Widget>)
fn set_main_widget(&mut self, widget: Box<dyn Widget>)
Set main widget. The widget will take the whole space of the UiPage.
Sourcefn get_resource_path(&self, link: &str) -> String
fn get_resource_path(&self, link: &str) -> String
Get path to the resource. Will be changed soon, please don’t use.
Add data processor to the UiPageContext.
It’s better to use [UiPageContext::add_data_processor] instead.
Sourcefn widget_generator(&mut self) -> &mut dyn WidgetGenerator
fn widget_generator(&mut self) -> &mut dyn WidgetGenerator
Returns reference to WidgetGenerator
fn open(&self, path: &str, data: &str) -> Result<(), CallError>
fn get_launch_string(&self) -> Result<String, CallError>
Provided Methods§
Implementations§
Source§impl dyn UiPageContext
impl dyn UiPageContext
Sourcepub fn add_data_processor<T>(
context: &mut dyn UiPageContext,
processor: T,
) -> Weak<RwLock<T>>where
T: 'static + DataProcessor,
pub fn add_data_processor<T>(
context: &mut dyn UiPageContext,
processor: T,
) -> Weak<RwLock<T>>where
T: 'static + DataProcessor,
Add data processor to the UiPaqeContext.
The processor will be called to process pending data each tick.