Skip to main content

Platform

Struct Platform 

Source
pub struct Platform { /* private fields */ }

Implementations§

Source§

impl Platform

Source

pub fn new( data_dir: impl Into<PathBuf>, cache_dir: impl Into<PathBuf>, locale: impl Into<String>, ) -> Result<Self, PlatformError>

Trait Implementations§

Source§

impl AppMouse for Platform

Source§

fn perform_app_mouse<'life0, 'async_trait>( &'life0 self, request: AppMouseRequest, ) -> Pin<Box<dyn Future<Output = Result<AppMouseResult, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl AppRuntime for Platform

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, _open_mode: LxAppOpenMode, _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 exit(&self) -> Result<(), PlatformError>

Exits the host app.
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}
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.
Source§

fn set_tray_badge(&self, _text: &str) -> Result<(), PlatformError>

Set the tray (menu-bar / system-tray) badge. Desktop only; no-op elsewhere.
Source§

fn set_tray_icon(&self, _icon: &str) -> Result<(), PlatformError>

Set the tray icon (a resource path). Desktop only; no-op elsewhere.
Source§

fn set_tray_title(&self, _text: &str) -> Result<(), PlatformError>

Set the tray title (text beside the icon, macOS). Desktop only; no-op elsewhere.
Source§

fn set_app_badge(&self, _text: &str) -> Result<(), PlatformError>

Set the app-icon badge: dock (macOS) / taskbar (Windows) / launcher icon (iOS, Android). No-op on platforms where it is not yet wired.
Source§

fn set_tray_menu(&self, _items_json: &str) -> Result<(), PlatformError>

Replace the tray dropdown menu. items_json is a JSON array of { label?, separator?, enabled?, checked? }. Item clicks are delivered back to JS by index. Desktop only; no-op elsewhere.
Source§

fn set_tray_visible(&self, _visible: bool) -> Result<(), PlatformError>

Show or hide the tray status item itself. Desktop only; no-op elsewhere.
Source§

fn set_tray_click_intercept( &self, _intercept: bool, ) -> Result<(), PlatformError>

When intercepting, a left-click on the tray is delivered only to JS (lx.tray.onClick) and does not run the tray’s configured surface action. Desktop only; no-op elsewhere.
Source§

impl AppScreenshot for Platform

Source§

fn list_app_windows<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<WindowInfo>, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Enumerate the app’s top-level windows. Read more
Source§

fn take_app_screenshot<'life0, 'life1, 'async_trait>( &'life0 self, window_id: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, PlatformError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Capture and return PNG-encoded bytes of the app’s window. Read more
Source§

impl Clone for Platform

Source§

fn clone(&self) -> Platform

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Platform

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Platform

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Device for Platform

Source§

impl DeviceHardware for Platform

Source§

fn get_memory_info(&self) -> Result<u64, PlatformError>

Get total physical memory in bytes.
Source§

fn get_cpu_count(&self) -> usize

Get the number of logical CPU cores available.
Source§

fn get_storage_total_bytes(&self) -> Result<u64, PlatformError>

Get total ROM storage in bytes.
Source§

impl FileService for Platform

Source§

impl Location for Platform

Source§

impl MediaInteraction for Platform

Source§

fn preview_media( &self, _request: PreviewMediaRequest, ) -> Result<(), PlatformError>

Preview media. Keeps callback_id pattern for AbortSignal support.
Source§

fn cancel_preview(&self, _callback_id: u64) -> Result<(), PlatformError>

Source§

fn choose_media( &self, _request: ChooseMediaRequest, ) -> impl Future<Output = Result<String, PlatformError>> + Send

Source§

fn scan_code( &self, _request: ScanCodeRequest, ) -> impl Future<Output = Result<String, PlatformError>> + Send

Source§

fn save_image_to_photos_album( &self, _request: SaveMediaRequest, ) -> impl Future<Output = Result<(), PlatformError>> + Send

Source§

fn save_video_to_photos_album( &self, _request: SaveMediaRequest, ) -> impl Future<Output = Result<(), PlatformError>> + Send

Source§

impl MediaRuntime for Platform

Source§

fn copy_album_media_to_file( &self, _uri: &str, _dest_path: &Path, _kind: MediaKind, ) -> Result<(), PlatformError>

Copy a picked/album media asset identified by uri into a local file at dest_path. Read more
Source§

fn get_image_info(&self, _uri: &str) -> Result<ImageInfo, PlatformError>

Source§

fn compress_image( &self, _request: &CompressImageRequest, ) -> Result<PathBuf, PlatformError>

Source§

fn compress_video( &self, _request: &CompressVideoRequest, ) -> Result<(), PlatformError>

Start a video transcode. Returns as soon as the job is accepted; progress and the final result arrive on the request’s callbacks.
Source§

fn cancel_compress_video(&self, _callback_id: u64) -> Result<(), PlatformError>

Cancel a running transcode by its completion callback_id. Native stops the job and SHOULD delete any partial output; it MUST NOT fire the completion callback afterwards (the caller already removed it).
Source§

fn get_video_info(&self, _uri: &str) -> Result<VideoInfo, PlatformError>

Source§

fn extract_video_thumbnail( &self, _request: &ExtractVideoThumbnailRequest, ) -> Result<VideoThumbnail, PlatformError>

Source§

impl Network for Platform

Source§

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

Source§

fn add_network_change_listener( &self, callback_id: u64, ) -> Result<(), PlatformError>

Add listener for network changes. Keeps callback_id for stream callbacks.
Source§

fn remove_network_change_listener( &self, callback_id: u64, ) -> Result<(), PlatformError>

Remove a previously registered network change listener.
Source§

impl PullToRefresh for Platform

Source§

fn start_pull_down_refresh( &self, _app_id: &str, _path: &str, ) -> Result<(), PlatformError>

Start pull-to-refresh animation programmatically. Read more
Source§

fn stop_pull_down_refresh( &self, _app_id: &str, _path: &str, ) -> Result<(), PlatformError>

Stop pull-to-refresh animation. Read more
Source§

impl SecureStore for Platform

Source§

fn read(&self, key: &str) -> Result<Option<Vec<u8>>, PlatformError>

Read a persisted value from a secure, app-scoped store that survives reinstall where supported.
Source§

fn contains(&self, key: &str) -> Result<bool, PlatformError>

Check whether a value exists in the secure store.
Source§

fn write(&self, key: &str, value: &[u8]) -> Result<(), PlatformError>

Persist a value into the secure store.
Source§

fn delete(&self, key: &str) -> Result<(), PlatformError>

Delete a value from the secure store.
Source§

impl ShareService for Platform

Source§

fn share( &self, _request: ShareRequest, ) -> impl Future<Output = Result<ShareResult, PlatformError>> + Send

Source§

impl SurfacePresenter for Platform

Source§

fn present_layout( &self, _window_id: &str, _plan: &LayoutPresentationPlan, ) -> Result<(), PlatformError>

The shared core resolves a LayoutPresentationPlan for one window/graph and the platform skin binds it. The per-surface methods below present a single surface at a time.
Source§

fn present_surface(&self, _request: SurfaceRequest) -> Result<(), PlatformError>

Source§

fn close_surface( &self, _app_id: &str, _id: &str, _reason: &str, ) -> Result<(), PlatformError>

Source§

fn show_surface(&self, _app_id: &str, _id: &str) -> Result<(), PlatformError>

Source§

fn hide_surface(&self, _app_id: &str, _id: &str) -> Result<(), PlatformError>

Source§

fn set_managed_surface_visible( &self, _id: &str, _visible: bool, ) -> Result<(), PlatformError>

Show or hide a top-level surface declared by the host (e.g. the AI-chat panel or terminal in ui config). Only platforms with a host shell that manages declared surfaces (currently macOS) support it; others have no such shell and return NotSupported.
Source§

fn toggle_managed_surface(&self, _id: &str) -> Result<(), PlatformError>

Toggle a host-declared top-level surface’s visibility. See set_managed_surface_visible.
Source§

impl UIUpdate for Platform

Source§

impl UpdateService for Platform

Source§

fn self_update_supported(&self) -> bool

Whether this platform installs host-app updates itself (download + in-place install/relaunch). Store-delivered platforms (iOS App Store, HarmonyOS AppGallery) return false: they must update through the store, so the update flow never downloads or self-installs there. Read more
Source§

fn open_update_store( &self, _update_info_json: &str, ) -> Result<bool, PlatformError>

Open the platform app-store page for this app so the user can update through the store. Used on store-delivered platforms when an update is available. Returns true if a store page was opened. Defaults to false (no in-app redirect; rely on the store’s own update prompts).
Source§

fn install_update( &self, package_path: &Path, info_json: &str, ) -> Result<(), PlatformError>

Requests installation of an application update from a local package file. Read more
Source§

impl UserFeedback for Platform

Source§

fn show_toast(&self, _options: ToastOptions) -> Result<(), PlatformError>

Source§

fn hide_toast(&self) -> Result<(), PlatformError>

Source§

fn show_modal( &self, _options: ModalOptions, ) -> impl Future<Output = Result<String, PlatformError>> + Send

Source§

fn show_action_sheet( &self, _options: Vec<String>, _cancel_text: String, _item_color: String, ) -> impl Future<Output = Result<String, PlatformError>> + Send

Source§

impl VideoPlayerManager for Platform

Source§

fn bind_player( &self, _component_id: &str, ) -> Result<Box<dyn VideoPlayerHandle>, PlatformError>

Bind to an existing native player. Read more
Source§

fn set_player_callback( &self, _component_id: &str, _callback_id: u64, ) -> Result<(), PlatformError>

Set (or update) the callback ID for video player events for a component. Read more
Source§

impl VideoStreamDecoderManager for Platform

Source§

impl Wifi for Platform

Source§

fn start_wifi(&self, callback_id: u64) -> Result<(), PlatformError>

Initialize Wi-Fi module (wx.startWifi). Read more
Source§

fn stop_wifi(&self, callback_id: u64) -> Result<(), PlatformError>

Stop Wi-Fi module (wx.stopWifi).
Source§

fn connect_wifi(&self, request: WifiConnectRequest) -> Result<(), PlatformError>

Connect to a Wi-Fi access point (wx.connectWifi). Read more
Source§

fn get_wifi_list(&self, callback_id: u64) -> Result<(), PlatformError>

Request a Wi-Fi scan and return results via callback (wx.getWifiList). Read more
Source§

fn get_connected_wifi( &self, request: WifiGetConnectedRequest, ) -> Result<(), PlatformError>

Get current connected Wi-Fi (wx.getConnectedWifi). Read more
Source§

fn is_wifi_enabled(&self) -> Result<bool, PlatformError>

Check if WiFi is currently enabled on the device (synchronous). Read more
Source§

fn add_wifi_state_listener(&self, callback_id: u64) -> Result<(), PlatformError>

Add a listener for WiFi connection state changes. Read more
Source§

fn remove_wifi_state_listener( &self, callback_id: u64, ) -> Result<(), PlatformError>

Remove a previously registered WiFi state listener. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more