Skip to main content

Platform

Trait Platform 

Source
pub trait Platform: 'static {
Show 57 methods // Required methods fn background_executor(&self) -> BackgroundExecutor; fn foreground_executor(&self) -> ForegroundExecutor; fn text_system(&self) -> Arc<dyn PlatformTextSystem> ; fn run(&self, on_finish_launching: Box<dyn FnOnce() + 'static>); fn quit(&self); fn restart(&self, binary_path: Option<PathBuf>); fn activate(&self, ignoring_other_apps: bool); fn hide(&self); fn hide_other_apps(&self); fn unhide_other_apps(&self); fn displays(&self) -> Vec<Rc<dyn PlatformDisplay>>; fn primary_display(&self) -> Option<Rc<dyn PlatformDisplay>>; fn active_window(&self) -> Option<AnyWindowHandle>; fn open_window( &self, handle: AnyWindowHandle, options: WindowParams, ) -> Result<Box<dyn PlatformWindow>>; fn window_appearance(&self) -> WindowAppearance; fn open_url(&self, url: &str); fn on_open_urls(&self, callback: Box<dyn FnMut(Vec<String>)>); fn register_url_scheme(&self, url: &str) -> Task<Result<()>> ; fn prompt_for_paths( &self, options: PathPromptOptions, ) -> Receiver<Result<Option<Vec<PathBuf>>>>; fn prompt_for_new_path( &self, directory: &Path, suggested_name: Option<&str>, ) -> Receiver<Result<Option<PathBuf>>>; fn can_select_mixed_files_and_dirs(&self) -> bool; fn reveal_path(&self, path: &Path); fn open_with_system(&self, path: &Path); fn on_quit(&self, callback: Box<dyn FnMut()>); fn on_reopen(&self, callback: Box<dyn FnMut()>); fn set_menus(&self, menus: Vec<Menu>, keymap: &Keymap); fn set_dock_menu(&self, menu: Vec<MenuItem>, keymap: &Keymap); fn on_app_menu_action(&self, callback: Box<dyn FnMut(&dyn Action)>); fn on_will_open_app_menu(&self, callback: Box<dyn FnMut()>); fn on_validate_app_menu_command( &self, callback: Box<dyn FnMut(&dyn Action) -> bool>, ); fn thermal_state(&self) -> ThermalState; fn on_thermal_state_change(&self, callback: Box<dyn FnMut()>); fn app_path(&self) -> Result<PathBuf>; fn path_for_auxiliary_executable(&self, name: &str) -> Result<PathBuf>; fn set_cursor_style(&self, style: CursorStyle); fn hide_cursor_until_mouse_moves(&self); fn is_cursor_visible(&self) -> bool; fn should_auto_hide_scrollbars(&self) -> bool; fn read_from_clipboard(&self) -> Option<ClipboardItem>; fn write_to_clipboard(&self, item: ClipboardItem); fn read_from_primary(&self) -> Option<ClipboardItem>; fn write_to_primary(&self, item: ClipboardItem); fn write_credentials( &self, url: &str, username: &str, password: &[u8], ) -> Task<Result<()>> ; fn read_credentials( &self, url: &str, ) -> Task<Result<Option<(String, Vec<u8>)>>> ; fn delete_credentials(&self, url: &str) -> Task<Result<()>> ; fn keyboard_layout(&self) -> Box<dyn PlatformKeyboardLayout>; fn keyboard_mapper(&self) -> Rc<dyn PlatformKeyboardMapper>; fn on_keyboard_layout_change(&self, callback: Box<dyn FnMut()>); // Provided methods fn window_stack(&self) -> Option<Vec<AnyWindowHandle>> { ... } fn is_screen_capture_supported(&self) -> bool { ... } fn screen_capture_sources( &self, ) -> Receiver<Result<Vec<Rc<dyn ScreenCaptureSource>>>> { ... } fn button_layout(&self) -> Option<WindowButtonLayout> { ... } fn get_menus(&self) -> Option<Vec<OwnedMenu>> { ... } fn perform_dock_menu_action(&self, _action: usize) { ... } fn add_recent_document(&self, _path: &Path) { ... } fn update_jump_list( &self, _menus: Vec<MenuItem>, _entries: Vec<SmallVec<[PathBuf; 2]>>, ) -> Task<Vec<SmallVec<[PathBuf; 2]>>> { ... } fn compositor_name(&self) -> &'static str { ... }
}

Required Methods§

Source

fn background_executor(&self) -> BackgroundExecutor

Source

fn foreground_executor(&self) -> ForegroundExecutor

Source

fn text_system(&self) -> Arc<dyn PlatformTextSystem>

Source

fn run(&self, on_finish_launching: Box<dyn FnOnce() + 'static>)

Source

fn quit(&self)

Source

fn restart(&self, binary_path: Option<PathBuf>)

Source

fn activate(&self, ignoring_other_apps: bool)

Source

fn hide(&self)

Source

fn hide_other_apps(&self)

Source

fn unhide_other_apps(&self)

Source

fn displays(&self) -> Vec<Rc<dyn PlatformDisplay>>

Source

fn primary_display(&self) -> Option<Rc<dyn PlatformDisplay>>

Source

fn active_window(&self) -> Option<AnyWindowHandle>

Source

fn open_window( &self, handle: AnyWindowHandle, options: WindowParams, ) -> Result<Box<dyn PlatformWindow>>

Source

fn window_appearance(&self) -> WindowAppearance

Returns the appearance of the application’s windows.

Source

fn open_url(&self, url: &str)

Source

fn on_open_urls(&self, callback: Box<dyn FnMut(Vec<String>)>)

Source

fn register_url_scheme(&self, url: &str) -> Task<Result<()>>

Source

fn prompt_for_paths( &self, options: PathPromptOptions, ) -> Receiver<Result<Option<Vec<PathBuf>>>>

Source

fn prompt_for_new_path( &self, directory: &Path, suggested_name: Option<&str>, ) -> Receiver<Result<Option<PathBuf>>>

Source

fn can_select_mixed_files_and_dirs(&self) -> bool

Source

fn reveal_path(&self, path: &Path)

Source

fn open_with_system(&self, path: &Path)

Source

fn on_quit(&self, callback: Box<dyn FnMut()>)

Source

fn on_reopen(&self, callback: Box<dyn FnMut()>)

Source

fn set_menus(&self, menus: Vec<Menu>, keymap: &Keymap)

Source

fn set_dock_menu(&self, menu: Vec<MenuItem>, keymap: &Keymap)

Source

fn on_app_menu_action(&self, callback: Box<dyn FnMut(&dyn Action)>)

Source

fn on_will_open_app_menu(&self, callback: Box<dyn FnMut()>)

Source

fn on_validate_app_menu_command( &self, callback: Box<dyn FnMut(&dyn Action) -> bool>, )

Source

fn thermal_state(&self) -> ThermalState

Source

fn on_thermal_state_change(&self, callback: Box<dyn FnMut()>)

Source

fn app_path(&self) -> Result<PathBuf>

Source

fn path_for_auxiliary_executable(&self, name: &str) -> Result<PathBuf>

Source

fn set_cursor_style(&self, style: CursorStyle)

Source

fn hide_cursor_until_mouse_moves(&self)

Hides the mouse cursor until the user moves the mouse over one of this application’s windows.

Source

fn is_cursor_visible(&self) -> bool

Returns whether the mouse cursor is currently visible.

Source

fn should_auto_hide_scrollbars(&self) -> bool

Source

fn read_from_clipboard(&self) -> Option<ClipboardItem>

Source

fn write_to_clipboard(&self, item: ClipboardItem)

Source

fn read_from_primary(&self) -> Option<ClipboardItem>

Source

fn write_to_primary(&self, item: ClipboardItem)

Source

fn write_credentials( &self, url: &str, username: &str, password: &[u8], ) -> Task<Result<()>>

Source

fn read_credentials(&self, url: &str) -> Task<Result<Option<(String, Vec<u8>)>>>

Source

fn delete_credentials(&self, url: &str) -> Task<Result<()>>

Source

fn keyboard_layout(&self) -> Box<dyn PlatformKeyboardLayout>

Source

fn keyboard_mapper(&self) -> Rc<dyn PlatformKeyboardMapper>

Source

fn on_keyboard_layout_change(&self, callback: Box<dyn FnMut()>)

Provided Methods§

Source

fn window_stack(&self) -> Option<Vec<AnyWindowHandle>>

Source

fn is_screen_capture_supported(&self) -> bool

Source

fn screen_capture_sources( &self, ) -> Receiver<Result<Vec<Rc<dyn ScreenCaptureSource>>>>

Source

fn button_layout(&self) -> Option<WindowButtonLayout>

Returns the window button layout configuration when supported.

Source

fn get_menus(&self) -> Option<Vec<OwnedMenu>>

Source

fn perform_dock_menu_action(&self, _action: usize)

Source

fn add_recent_document(&self, _path: &Path)

Source

fn update_jump_list( &self, _menus: Vec<MenuItem>, _entries: Vec<SmallVec<[PathBuf; 2]>>, ) -> Task<Vec<SmallVec<[PathBuf; 2]>>>

Source

fn compositor_name(&self) -> &'static str

Implementors§