Skip to main content

WinPlatformServices

Struct WinPlatformServices 

Source
pub struct WinPlatformServices { /* private fields */ }
Available on crate feature win only.

Implementations§

Trait Implementations§

Source§

impl Default for WinPlatformServices

Source§

fn default() -> Self

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

impl PlatformServices for WinPlatformServices

Source§

fn show_folder_open_dialog(&self, opts: FileDialogOptions) -> Option<PathBuf>

The shell folder-picker (IFileOpenDialog + FOS_PICKFOLDERS).

Source§

fn show_message_dialog( &self, opts: MessageDialogOptions, ) -> Option<MessageDialogChoice>

TaskDialogIndirect — see this module’s doc comment for why TaskDialog over the legacy MessageBoxW.

Source§

fn open_url_result(&self, url: &str) -> ServiceResult<()>

Fallible twin of Self::open_url: reports ShellExecuteW’s real outcome via [crate::desktop::open_with_default] instead of open_url’s discarded one — before this override, open_url_result fell to crate::backend::PlatformServices::open_url_result’s default (open_url then always Ok(())), so a failed ShellExecuteW call (e.g. SE_ERR_FNF — the target does not exist) was silently reported as success.

Note what this still cannot promise: ShellExecuteW reports whether it handed the target off, not whether anything subsequently opened. An unregistered URI scheme, for instance, returns success (42) because the shell accepted it and will sort out the missing handler asynchronously — see this module’s open_url_result_and_open_path_report_a_real_shell_execute_failure test for the failure this can honestly detect.

Source§

fn reveal_in_file_manager(&self, path: &Path) -> ServiceResult<()>

SHOpenFolderAndSelectItems — see win_reveal_in_file_manager’s doc for the ILCreateFromPathW/ ILClone/ILRemoveLastID PIDL dance it takes.

Source§

fn open_path(&self, path: &Path) -> ServiceResult<()>

ShellExecuteW(NULL, "open", path, ...) via [crate::desktop::open_with_default] — the exact same call Self::open_url_result makes above, just fed a filesystem path instead of a URL string; ShellExecuteW’s "open" verb already accepts either.

Source§

fn move_to_trash(&self, path: &Path) -> ServiceResult<()>

[crate::desktop::move_to_trash] — see that function’s doc for why every backend, Win-GUI included, shares this one trash-crate-backed implementation rather than hand-rolling SHFileOperationW(FOF_ALLOWUNDO) here.

Source§

fn beep(&self) -> ServiceResult<()>

MessageBeep(MB_OK) — the default system notification sound (Windows’ Settings maps MB_OK’s alias, “Asterisk”/ “Default Beep” depending on the Windows version, to whichever sound scheme the user picked; there is no dedicated “just beep” API distinct from this legacy MessageBoxW-family sound-alias mechanism).

Source§

fn system_theme(&self) -> ServiceResult<SystemTheme>

UISettings::GetColorValue (Background/Accent) + AccessibilitySettings::HighContrast — see this module’s WinRT import comment for why the latter comes from the same namespace rather than a separate Win32 SPI call.

Source§

fn displays(&self) -> ServiceResult<Vec<Display>>

EnumDisplayMonitors + GetMonitorInfoW for bounds/work_area/ primary (rcMonitor/rcWork/MONITORINFOF_PRIMARY), GetDpiForMonitor for scale.

Source§

fn cursor_screen_point(&self) -> ServiceResult<Point>

GetCursorPos — the global cursor position in virtual-screen coordinates, the same coordinate space Self::displays’s bounds/work_area use.

Source§

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

Platform identifier — matches the BackendNative.backend field. One of "tui", "gtk", "win-gui", "macos".
Source§

fn clipboard(&self) -> &dyn Clipboard

Source§

fn show_file_open_dialog(&self, opts: FileDialogOptions) -> Option<PathBuf>

Show a native file-open dialog (blocking). Returns None if the user cancelled. TUI backends have no native dialog to show and unconditionally return None (no stderr hint is written); apps should provide an in-TUI picker instead.
Source§

fn show_file_save_dialog(&self, opts: FileDialogOptions) -> Option<PathBuf>

Show a native file-save dialog.
Source§

fn send_notification(&self, n: Notification)

Dispatch a system notification — see Notification’s doc for icon/actions/silent/tag. Read more
Source§

fn open_url(&self, url: &str)

Open a URL in the platform’s default browser.
Source§

fn secret_store(&self) -> &dyn SecretStore

The OS credential store — Keychain (macOS), Secret Service (Linux), Windows Credential Manager — for apps that hold an API token, a password, or an OAuth refresh token and would otherwise have no choice but to invent their own storage or write it to plaintext config. 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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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