pub struct FakeServices { /* private fields */ }Expand description
Install with Ui::set_services.
Implementations§
Source§impl FakeServices
impl FakeServices
pub fn new() -> (FakeServices, FakeServicesHandle)
Trait Implementations§
Source§impl Default for FakeServices
impl Default for FakeServices
Source§impl Services for FakeServices
impl Services for FakeServices
Source§fn window_destroyed(&mut self, window: NodeId)
fn window_destroyed(&mut self, window: NodeId)
Alerts and file dialogs asked for on the window answer as their cancel would. Those without a parent stay: the fake doesn’t know which window is focused.
Source§fn clipboard_text(&mut self, reply: Reply<Option<String>>)
fn clipboard_text(&mut self, reply: Reply<Option<String>>)
Reads the clipboard’s text. Async because GTK and WinUI only read the
clipboard asynchronously; platforms that can may reply right away.
Source§fn set_clipboard_text(
&mut self,
text: &str,
reply: Reply<Result<(), ServiceError>>,
)
fn set_clipboard_text( &mut self, text: &str, reply: Reply<Result<(), ServiceError>>, )
Writes the clipboard (it can fail: e.g. another process holds it).
Source§fn alert(&mut self, parent: Option<NodeId>, alert: &Alert, reply: Reply<usize>)
fn alert(&mut self, parent: Option<NodeId>, alert: &Alert, reply: Reply<usize>)
Shows an alert, attached to
parent if given (a sheet on macOS) or
to the active window. Must not block: reply when the user answers.Source§fn open_file(
&mut self,
parent: Option<NodeId>,
request: &OpenFile,
reply: Reply<Option<Vec<PathBuf>>>,
)
fn open_file( &mut self, parent: Option<NodeId>, request: &OpenFile, reply: Reply<Option<Vec<PathBuf>>>, )
Replies with the chosen paths, or
None if cancelled.fn save_file( &mut self, parent: Option<NodeId>, request: &SaveFile, reply: Reply<Option<PathBuf>>, )
Source§fn trash(
&mut self,
parent: Option<NodeId>,
paths: &[PathBuf],
reply: Reply<Result<(), ServiceError>>,
)
fn trash( &mut self, parent: Option<NodeId>, paths: &[PathBuf], reply: Reply<Result<(), ServiceError>>, )
Moves files and folders to the user’s trash, as the platform’s file
manager does, so they can be put back from there. Items go one after
another; the reply comes once all have gone, or with the first
failure, and those before it stay in the trash.
Unavailable: the
item’s disk has no trash. Cancelled: the user said no where the
platform asks first (Windows, when its settings say so).Source§fn launch(
&mut self,
parent: Option<NodeId>,
target: &Launch,
reply: Reply<Result<(), ServiceError>>,
)
fn launch( &mut self, parent: Option<NodeId>, target: &Launch, reply: Reply<Result<(), ServiceError>>, )
Opens a file, folder or URL in the app the platform picks for it,
as its file manager would on a double-click. The platform may ask
which app when none is set;
Cancelled if the user dismissed it,
Unavailable if no app opens it. Replies once the platform has
handed it over, not when the app has opened it.Source§fn notify(
&mut self,
notification: &Notification,
activated: Rc<dyn Fn(String)>,
reply: Reply<Result<(), ServiceError>>,
)
fn notify( &mut self, notification: &Notification, activated: Rc<dyn Fn(String)>, reply: Reply<Result<(), ServiceError>>, )
Shows a notification outside the app’s windows, as the platform
shows its apps’, replacing the one with the same id
(
notification.id is always set). Replies once the platform has it:
Cancelled if the user turned the app’s notifications off or said
no when the platform asked, Unavailable if there’s nothing to show
it (no notification server, a macOS app outside a bundle). When the
user clicks it, the platform brings the app forward, as it does for
its own apps, and the backend calls activated with its id.Source§fn withdraw_notification(&mut self, id: &str)
fn withdraw_notification(&mut self, id: &str)
Takes the notification with this id away, from the screen and the
platform’s list. Nothing happens if there’s none.
Installs a menu bar: the app’s (
window is None), or one
window’s own menus, which it shows with the app’s
(MenuBarData::merged). Called again whenever the bar changes;
an empty bar removes a window’s menus. A window’s menus may arrive
before the window is created, and after it’s destroyed. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for FakeServices
impl !Send for FakeServices
impl !Sync for FakeServices
impl !UnwindSafe for FakeServices
impl Forget for FakeServices
impl Freeze for FakeServices
impl Move for FakeServices
impl Unpin for FakeServices
impl UnsafeUnpin for FakeServices
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