pub struct MiniAppPlatform { /* private fields */ }Expand description
Unified Rust/WASM Mini-Program host adapter abstracting WeChat, Alipay, Douyin, Baidu, QQ, Kuaishou, and HarmonyOS Atomic Service.
Implementations§
Source§impl MiniAppPlatform
Vendor constructors, touch/IME/lifecycle translation, and outbound bridge queue helpers for MiniAppPlatform.
impl MiniAppPlatform
Vendor constructors, touch/IME/lifecycle translation, and outbound bridge queue helpers for MiniAppPlatform.
Sourcepub fn for_vendor(vendor: MiniAppVendor) -> Self
pub fn for_vendor(vendor: MiniAppVendor) -> Self
Sourcepub fn from_system_info(system_info: MiniAppSystemInfo) -> Self
pub fn from_system_info(system_info: MiniAppSystemInfo) -> Self
Sourcepub fn primary_window_id(&self) -> Option<WindowId>
pub fn primary_window_id(&self) -> Option<WindowId>
Sourcepub fn drain_host_commands(&mut self) -> Vec<MiniAppHostCommand>
pub fn drain_host_commands(&mut self) -> Vec<MiniAppHostCommand>
Sourcepub fn update_system_info(&mut self, info: MiniAppSystemInfo)
pub fn update_system_info(&mut self, info: MiniAppSystemInfo)
Updates host MiniAppSystemInfo (e.g. after orientation change or capsule query) and emits SafeAreaChanged.
§Arguments
&Self- Mutable Mini-program platform.MiniAppSystemInfo- Updated host system info.
Sourcepub fn handle_touch(
&mut self,
action: i32,
touches: &[(i32, f32, f32)],
) -> Vec<WindowEvent>
pub fn handle_touch( &mut self, action: i32, touches: &[(i32, f32, f32)], ) -> Vec<WindowEvent>
Translates Mini-Program <canvas> touch callbacks (touchstart/touchmove/touchend/touchcancel) into EUV pointer events.
§Arguments
&Self- Mutable Mini-program platform.i32- Normalized action (ANDROID_ACTION_DOWN/MOVE/UP/CANCEL).&[(i32, f32, f32)]- Active touch contact tuples(identifier, logical_x, logical_y).
§Returns
Vec<WindowEvent>- Normalized pointer events also enqueued forpoll_events().
Sourcepub fn handle_ime_input(&mut self, text: String, confirmed: bool)
pub fn handle_ime_input(&mut self, text: String, confirmed: bool)
Dispatches UTF-8 text input received from a hidden Mini-Program <input> or onKeyboardInput bridge.
§Arguments
&Self- Mutable Mini-program platform.String- Committed UTF-8 text.bool- Whentrue, also emitsKeyCode::Enterconfirmation.
Sourcepub fn handle_lifecycle_hook(
&mut self,
hook: MiniAppLifecycleHook,
) -> Vec<WindowEvent>
pub fn handle_lifecycle_hook( &mut self, hook: MiniAppLifecycleHook, ) -> Vec<WindowEvent>
Translates Mini-Program onLaunch / onShow / onHide / onUnload and system hooks into canonical EUV SystemEvents.
§Arguments
&Self- Mutable Mini-program platform.MiniAppLifecycleHook- Vendor-neutral lifecycle hook payload.
§Returns
Vec<WindowEvent>- Normalized events also enqueued forpoll_events().
Source§impl MiniAppPlatform
impl MiniAppPlatform
pub fn get_system_info(&self) -> &MiniAppSystemInfo
pub fn get_mut_system_info(&mut self) -> &mut MiniAppSystemInfo
pub fn set_system_info(&mut self, val: MiniAppSystemInfo) -> &mut Self
pub fn get_resolved_safe_area(&self) -> SafeAreaInsets
pub fn get_mut_resolved_safe_area(&mut self) -> &mut SafeAreaInsets
pub fn set_resolved_safe_area(&mut self, val: SafeAreaInsets) -> &mut Self
pub fn get_mut_primary_window(&mut self) -> &mut Option<WindowId>
pub fn set_primary_window(&mut self, val: Option<WindowId>) -> &mut Self
pub fn get_windows(&self) -> &HashMap<WindowId, MiniAppWindowRecord>
pub fn get_mut_windows(&mut self) -> &mut HashMap<WindowId, MiniAppWindowRecord>
pub fn set_windows( &mut self, val: HashMap<WindowId, MiniAppWindowRecord>, ) -> &mut Self
pub fn get_touch_tracker(&self) -> &TouchPointerTracker
pub fn get_mut_touch_tracker(&mut self) -> &mut TouchPointerTracker
pub fn set_touch_tracker(&mut self, val: TouchPointerTracker) -> &mut Self
pub fn get_pending_events(&self) -> &Vec<WindowEvent>
pub fn get_mut_pending_events(&mut self) -> &mut Vec<WindowEvent>
pub fn set_pending_events(&mut self, val: Vec<WindowEvent>) -> &mut Self
pub fn get_outbound_commands(&self) -> &Vec<MiniAppHostCommand>
pub fn get_mut_outbound_commands(&mut self) -> &mut Vec<MiniAppHostCommand>
pub fn set_outbound_commands( &mut self, val: Vec<MiniAppHostCommand>, ) -> &mut Self
pub fn get_storage(&self) -> &HashMap<String, String>
pub fn get_mut_storage(&mut self) -> &mut HashMap<String, String>
pub fn set_storage(&mut self, val: HashMap<String, String>) -> &mut Self
pub fn get_route_stack(&self) -> &Vec<String>
pub fn get_mut_route_stack(&mut self) -> &mut Vec<String>
pub fn set_route_stack(&mut self, val: Vec<String>) -> &mut Self
pub fn get_mut_clipboard(&mut self) -> &mut Option<String>
pub fn set_clipboard(&mut self, val: Option<String>) -> &mut Self
pub fn get_pump_paused(&self) -> bool
pub fn get_mut_pump_paused(&mut self) -> &mut bool
pub fn set_pump_paused(&mut self, val: bool) -> &mut Self
Trait Implementations§
Source§impl Clone for MiniAppPlatform
impl Clone for MiniAppPlatform
Source§impl Debug for MiniAppPlatform
impl Debug for MiniAppPlatform
Source§impl Default for MiniAppPlatform
Default MiniAppPlatform targeting WeChat (MiniAppVendor::WeChat).
impl Default for MiniAppPlatform
Default MiniAppPlatform targeting WeChat (MiniAppVendor::WeChat).
Source§impl PlatformBackend for MiniAppPlatform
PlatformBackend implementation for MiniAppPlatform.
impl PlatformBackend for MiniAppPlatform
PlatformBackend implementation for MiniAppPlatform.
Source§fn kind(&self) -> PlatformKind
fn kind(&self) -> PlatformKind
Source§fn capabilities(&self) -> PlatformCapabilities
fn capabilities(&self) -> PlatformCapabilities
Source§fn create_window(
&mut self,
config: &WindowConfig,
) -> Result<WindowState, PlatformError>
fn create_window( &mut self, config: &WindowConfig, ) -> Result<WindowState, PlatformError>
Source§fn window_state(&self, id: WindowId) -> Option<WindowState>
fn window_state(&self, id: WindowId) -> Option<WindowState>
Source§fn raw_window_handle(&self, id: WindowId) -> RawWindowHandle
fn raw_window_handle(&self, id: WindowId) -> RawWindowHandle
Source§fn poll_events(&mut self) -> Vec<WindowEvent>
fn poll_events(&mut self) -> Vec<WindowEvent>
Source§fn set_frame_pump_paused(&mut self, paused: bool)
fn set_frame_pump_paused(&mut self, paused: bool)
Pauses or resumes the Mini-Program canvas frame pump flag.
§Arguments
&Self- Mutable Mini-program platform.bool-truewhen hidden.
Source§fn is_frame_pump_paused(&self) -> bool
fn is_frame_pump_paused(&self) -> bool
Source§fn present_framebuffer(
&mut self,
id: WindowId,
framebuffer: &Framebuffer,
) -> Result<(), PlatformError>
fn present_framebuffer( &mut self, id: WindowId, framebuffer: &Framebuffer, ) -> Result<(), PlatformError>
Source§fn read_clipboard(&self) -> Option<String>
fn read_clipboard(&self) -> Option<String>
Source§fn write_clipboard(&mut self, text: &str) -> Result<(), PlatformError>
fn write_clipboard(&mut self, text: &str) -> Result<(), PlatformError>
Source§fn system_theme(&self) -> ThemeMode
fn system_theme(&self) -> ThemeMode
Source§fn wait_for_events(&mut self) -> Vec<WindowEvent>
fn wait_for_events(&mut self) -> Vec<WindowEvent>
Source§fn present_framebuffer_region(
&mut self,
id: WindowId,
framebuffer: &Framebuffer,
_damage: DamageRegion,
) -> Result<(), PlatformError>
fn present_framebuffer_region( &mut self, id: WindowId, framebuffer: &Framebuffer, _damage: DamageRegion, ) -> Result<(), PlatformError>
Framebuffer when supported by the backend. Read moreSource§fn display_refresh_rate_hz(&self) -> f32
fn display_refresh_rate_hz(&self) -> f32
60.0 fallback). Read moreSource§impl PlatformHostAdapter for MiniAppPlatform
PlatformHostAdapter implementation for MiniAppPlatform.
impl PlatformHostAdapter for MiniAppPlatform
PlatformHostAdapter implementation for MiniAppPlatform.
Source§fn device_form_factor(&self) -> DeviceFormFactor
fn device_form_factor(&self) -> DeviceFormFactor
Source§impl PlatformLifecycleBridge for MiniAppPlatform
PlatformLifecycleBridge implementation for MiniAppPlatform.
impl PlatformLifecycleBridge for MiniAppPlatform
PlatformLifecycleBridge implementation for MiniAppPlatform.
Source§fn freeze_surface(&mut self) -> Vec<WindowEvent>
fn freeze_surface(&mut self) -> Vec<WindowEvent>
Source§fn resume_surface(&mut self) -> Vec<WindowEvent>
fn resume_surface(&mut self) -> Vec<WindowEvent>
Source§fn destroy_surface(&mut self) -> Vec<WindowEvent>
fn destroy_surface(&mut self) -> Vec<WindowEvent>
Source§impl PlatformStorage for MiniAppPlatform
PlatformStorage implementation for MiniAppPlatform.
impl PlatformStorage for MiniAppPlatform
PlatformStorage implementation for MiniAppPlatform.
Source§fn storage_set(&mut self, key: &str, value: &str) -> Result<(), PlatformError>
fn storage_set(&mut self, key: &str, value: &str) -> Result<(), PlatformError>
Source§fn storage_remove(&mut self, key: &str) -> Result<(), PlatformError>
fn storage_remove(&mut self, key: &str) -> Result<(), PlatformError>
Source§fn storage_clear(&mut self) -> Result<(), PlatformError>
fn storage_clear(&mut self) -> Result<(), PlatformError>
Source§impl WindowController for MiniAppPlatform
WindowController implementation for MiniAppPlatform.
impl WindowController for MiniAppPlatform
WindowController implementation for MiniAppPlatform.