Skip to main content

AppRuntime

Trait AppRuntime 

Source
pub trait AppRuntime:
    Send
    + Sync
    + MediaInteraction
    + MediaRuntime
    + Network
    + PopupPresenter
    + Device
    + DeviceHardware
    + SecureStore
    + FileInteraction
    + Location
    + UIUpdate
    + UpdateService
    + UserFeedback
    + Wifi
    + 'static {
    // Required methods
    fn read_asset<'a>(
        &'a self,
        path: &str,
    ) -> Result<Box<dyn Read + 'a>, PlatformError>;
    fn asset_dir_iter<'a>(
        &'a self,
        asset_dir: &str,
    ) -> Box<dyn Iterator<Item = Result<AssetFileEntry<'a>, PlatformError>> + 'a>;
    fn app_data_dir(&self) -> PathBuf;
    fn app_cache_dir(&self) -> PathBuf;
    fn get_app_identifier(&self) -> Result<String, PlatformError>;
    fn get_system_locale(&self) -> &str;
    fn show_lxapp(
        &self,
        appid: String,
        path: String,
        session_id: u64,
        presentation: LxAppPresentation,
        panel_id: String,
    ) -> Result<(), PlatformError>;
    fn hide_lxapp(
        &self,
        appid: String,
        session_id: u64,
    ) -> Result<(), PlatformError>;
    fn navigate(
        &self,
        appid: String,
        path: String,
        animation_type: AnimationType,
    ) -> Result<(), PlatformError>;
    fn open_url(&self, req: OpenUrlRequest) -> Result<(), PlatformError>;
    fn get_capsule_rect(
        &self,
    ) -> impl Future<Output = Result<String, PlatformError>> + Send;

    // Provided method
    fn copy_album_media_to_file(
        &self,
        uri: &str,
        dest_path: &Path,
        kind: MediaKind,
    ) -> Result<(), PlatformError> { ... }
}

Required Methods§

Source

fn read_asset<'a>( &'a self, path: &str, ) -> Result<Box<dyn Read + 'a>, PlatformError>

Reads an asset file as a streaming reader.

Source

fn asset_dir_iter<'a>( &'a self, asset_dir: &str, ) -> Box<dyn Iterator<Item = Result<AssetFileEntry<'a>, PlatformError>> + 'a>

Iterates over files in an asset directory.

Source

fn app_data_dir(&self) -> PathBuf

Returns the app’s data directory path.

Source

fn app_cache_dir(&self) -> PathBuf

Returns the app’s cache directory path.

Source

fn get_app_identifier(&self) -> Result<String, PlatformError>

Obtains the application identifier.

Source

fn get_system_locale(&self) -> &str

Returns the current system locale.

Source

fn show_lxapp( &self, appid: String, path: String, session_id: u64, presentation: LxAppPresentation, panel_id: String, ) -> Result<(), PlatformError>

Show the UI container for the given LxApp and route.

Source

fn hide_lxapp( &self, appid: String, session_id: u64, ) -> Result<(), PlatformError>

Hide the UI container for the given LxApp (does not destroy its runtime state).

Source

fn navigate( &self, appid: String, path: String, animation_type: AnimationType, ) -> Result<(), PlatformError>

Navigates within the given LxApp using an animation.

Source

fn open_url(&self, req: OpenUrlRequest) -> Result<(), PlatformError>

Opens the given URL according to the host policy for the requested target.

Source

fn get_capsule_rect( &self, ) -> impl Future<Output = Result<String, PlatformError>> + Send

Gets the capsule button bounding rect in screen coordinates. Returns JSON: {“width”: f64, “height”: f64, “top”: f64, “right”: f64, “bottom”: f64, “left”: f64}

Provided Methods§

Source

fn copy_album_media_to_file( &self, uri: &str, dest_path: &Path, kind: MediaKind, ) -> Result<(), PlatformError>

Copies media from the system album to a local file.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§