pub struct Platform { /* private fields */ }Implementations§
Trait Implementations§
Source§impl AppMouse for Platform
impl AppMouse for Platform
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
impl AppRuntime for Platform
Source§fn read_asset<'a>(
&'a self,
_path: &str,
) -> Result<Box<dyn Read + 'a>, PlatformError>
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>
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
fn app_data_dir(&self) -> PathBuf
Returns the app’s data directory path.
Source§fn app_cache_dir(&self) -> PathBuf
fn app_cache_dir(&self) -> PathBuf
Returns the app’s cache directory path.
Source§fn get_app_identifier(&self) -> Result<String, PlatformError>
fn get_app_identifier(&self) -> Result<String, PlatformError>
Obtains the application identifier.
Source§fn get_system_locale(&self) -> &str
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>
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>
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).
Navigates within the given LxApp using an animation.
Source§fn open_url(&self, _req: OpenUrlRequest) -> Result<(), PlatformError>
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
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>
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>
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>
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>
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>
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.
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>
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>
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
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,
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,
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 Device for Platform
impl Device for Platform
fn device_info(&self) -> DeviceInfo
fn screen_info(&self) -> ScreenInfo
fn vibrate(&self, _long: bool) -> Result<(), PlatformError>
fn make_phone_call(&self, _phone_number: &str) -> Result<(), PlatformError>
Source§impl DeviceHardware for Platform
impl DeviceHardware for Platform
Source§fn get_memory_info(&self) -> Result<u64, PlatformError>
fn get_memory_info(&self) -> Result<u64, PlatformError>
Get total physical memory in bytes.
Source§fn get_cpu_count(&self) -> usize
fn get_cpu_count(&self) -> usize
Get the number of logical CPU cores available.
Source§fn get_storage_total_bytes(&self) -> Result<u64, PlatformError>
fn get_storage_total_bytes(&self) -> Result<u64, PlatformError>
Get total ROM storage in bytes.
Source§impl FileService for Platform
impl FileService for Platform
fn review_file( &self, _request: OpenFileRequest, ) -> impl Future<Output = Result<(), PlatformError>> + Send
fn open_external( &self, _request: OpenFileRequest, ) -> impl Future<Output = Result<(), PlatformError>> + Send
fn reveal_in_file_manager( &self, _request: RevealInFileManagerRequest, ) -> impl Future<Output = Result<(), PlatformError>> + Send
fn choose_file( &self, _request: ChooseFileRequest, ) -> impl Future<Output = Result<FileDialogResult, PlatformError>> + Send
fn choose_directory( &self, _request: ChooseDirectoryRequest, ) -> impl Future<Output = Result<FileDialogResult, PlatformError>> + Send
Source§impl Location for Platform
impl Location for Platform
fn is_location_enabled(&self) -> Result<bool, PlatformError>
fn request_location( &self, _config: LocationRequestConfig, ) -> impl Future<Output = Result<String, PlatformError>> + Send
Source§impl MediaInteraction for Platform
impl MediaInteraction for Platform
Source§fn preview_media(
&self,
_request: PreviewMediaRequest,
) -> Result<(), PlatformError>
fn preview_media( &self, _request: PreviewMediaRequest, ) -> Result<(), PlatformError>
Preview media. Keeps callback_id pattern for AbortSignal support.
fn cancel_preview(&self, _callback_id: u64) -> Result<(), PlatformError>
fn choose_media( &self, _request: ChooseMediaRequest, ) -> impl Future<Output = Result<String, PlatformError>> + Send
fn scan_code( &self, _request: ScanCodeRequest, ) -> impl Future<Output = Result<String, PlatformError>> + Send
fn save_image_to_photos_album( &self, _request: SaveMediaRequest, ) -> impl Future<Output = Result<(), PlatformError>> + Send
fn save_video_to_photos_album( &self, _request: SaveMediaRequest, ) -> impl Future<Output = Result<(), PlatformError>> + Send
Source§impl MediaRuntime for Platform
impl MediaRuntime for Platform
Source§fn copy_album_media_to_file(
&self,
_uri: &str,
_dest_path: &Path,
_kind: MediaKind,
) -> Result<(), PlatformError>
fn copy_album_media_to_file( &self, _uri: &str, _dest_path: &Path, _kind: MediaKind, ) -> Result<(), PlatformError>
fn get_image_info(&self, _uri: &str) -> Result<ImageInfo, PlatformError>
fn compress_image( &self, _request: &CompressImageRequest, ) -> Result<PathBuf, PlatformError>
Source§fn compress_video(
&self,
_request: &CompressVideoRequest,
) -> Result<(), PlatformError>
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>
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).fn get_video_info(&self, _uri: &str) -> Result<VideoInfo, PlatformError>
fn extract_video_thumbnail( &self, _request: &ExtractVideoThumbnailRequest, ) -> Result<VideoThumbnail, PlatformError>
Source§impl Network for Platform
impl Network for Platform
fn get_network_info( &self, ) -> impl Future<Output = Result<String, PlatformError>> + Send
Source§fn add_network_change_listener(
&self,
callback_id: u64,
) -> Result<(), PlatformError>
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>
fn remove_network_change_listener( &self, callback_id: u64, ) -> Result<(), PlatformError>
Remove a previously registered network change listener.
Source§impl PullToRefresh for Platform
impl PullToRefresh for Platform
Source§fn start_pull_down_refresh(
&self,
_app_id: &str,
_path: &str,
) -> Result<(), PlatformError>
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>
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
impl SecureStore for Platform
Source§fn read(&self, key: &str) -> Result<Option<Vec<u8>>, PlatformError>
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>
fn contains(&self, key: &str) -> Result<bool, PlatformError>
Check whether a value exists in the secure store.
Source§impl SurfacePresenter for Platform
impl SurfacePresenter for Platform
Source§fn present_layout(
&self,
_window_id: &str,
_plan: &LayoutPresentationPlan,
) -> Result<(), PlatformError>
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.fn present_surface(&self, _request: SurfaceRequest) -> Result<(), PlatformError>
fn close_surface( &self, _app_id: &str, _id: &str, _reason: &str, ) -> Result<(), PlatformError>
fn show_surface(&self, _app_id: &str, _id: &str) -> Result<(), PlatformError>
fn hide_surface(&self, _app_id: &str, _id: &str) -> Result<(), PlatformError>
Source§fn set_managed_surface_visible(
&self,
_id: &str,
_visible: bool,
) -> Result<(), PlatformError>
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>
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
impl UIUpdate for Platform
fn update_tabbar_ui(&self, _appid: String) -> Result<(), PlatformError>
fn update_orientation_ui(&self, _appid: String) -> Result<(), PlatformError>
Source§impl UpdateService for Platform
impl UpdateService for Platform
Source§fn self_update_supported(&self) -> bool
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 moreSource§fn open_update_store(
&self,
_update_info_json: &str,
) -> Result<bool, PlatformError>
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>
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
impl UserFeedback for Platform
fn show_toast(&self, _options: ToastOptions) -> Result<(), PlatformError>
fn hide_toast(&self) -> Result<(), PlatformError>
fn show_modal( &self, _options: ModalOptions, ) -> impl Future<Output = Result<String, PlatformError>> + Send
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
impl VideoPlayerManager for Platform
Source§fn bind_player(
&self,
_component_id: &str,
) -> Result<Box<dyn VideoPlayerHandle>, PlatformError>
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>
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
impl VideoStreamDecoderManager for Platform
fn create_stream_decoder( &self, _component_id: &str, ) -> Result<Box<dyn VideoStreamDecoderHandle>, PlatformError>
Source§impl Wifi for Platform
impl Wifi for Platform
Source§fn start_wifi(&self, callback_id: u64) -> Result<(), PlatformError>
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>
fn stop_wifi(&self, callback_id: u64) -> Result<(), PlatformError>
Stop Wi-Fi module (wx.stopWifi).
Source§fn connect_wifi(&self, request: WifiConnectRequest) -> Result<(), PlatformError>
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>
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>
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>
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>
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>
fn remove_wifi_state_listener( &self, callback_id: u64, ) -> Result<(), PlatformError>
Remove a previously registered WiFi state listener. Read more
Auto Trait Implementations§
impl Freeze for Platform
impl RefUnwindSafe for Platform
impl Send for Platform
impl Sync for Platform
impl Unpin for Platform
impl UnsafeUnpin for Platform
impl UnwindSafe for Platform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more