Application

Trait Application 

Source
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§

Source

fn get_env_var(&self, var_name: &str) -> Option<String>

Get value for environment vairable by variable name

Source

fn set_title(&self, title: &str)

Set title for the related window/activity/tab/etc.

Source

fn set_main_widget(&mut self, widget: Box<dyn Widget>)

Set main widget. The widget will take the whole space of the UiPage.

Source

fn get_resource_path(&self, link: &str) -> String

Get path to the resource. Will be changed soon, please don’t use.

Source

fn add_data_processor_shared(&mut self, dp: Arc<RwLock<dyn DataProcessor>>)

Add data processor to the UiPageContext.

It’s better to use [UiPageContext::add_data_processor] instead.

Source

fn widget_generator(&mut self) -> &mut dyn WidgetGenerator

Returns reference to WidgetGenerator

Source

fn open(&self, path: &str, data: &str) -> Result<(), CallError>

Source

fn get_launch_string(&self) -> Result<String, CallError>

Provided Methods§

Source

fn get_host(&self) -> String

Temporary. Will be removed soon.

Implementations§

Source§

impl dyn UiPageContext

Source

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.

Source

pub fn open_page<T>( context: &dyn UiPageContext, target: &dyn UiPage<Data = T>, ) -> Result<(), CallError>
where T: 'static + DeserializeOwned + Serialize,

Source

pub fn open_page_with_data<T>( context: &dyn UiPageContext, target: &dyn UiPage<Data = T>, data: &T, ) -> Result<(), CallError>
where T: 'static + DeserializeOwned + Serialize,

Source

pub fn get_launch_parameter<T>( context: &dyn UiPageContext, page: &dyn UiPage<Data = T>, ) -> Result<T, CallError>
where T: 'static + DeserializeOwned + Serialize,

Implementors§