pub struct FileDialogHandle { /* private fields */ }Expand description
Per-app file-dialog service. Registered in app-state by
TeksiloAppBuilder::install_file_dialog;
reachable from any handler via
ctx.app_state::<FileDialogHandle>(). Cloneable; clones share the
same backend and pending-callbacks map.
Implementations§
Source§impl FileDialogHandle
impl FileDialogHandle
Sourcepub fn new<B: FileDialogBackend + 'static>(backend: B) -> Self
pub fn new<B: FileDialogBackend + 'static>(backend: B) -> Self
Build a handle wrapping the given backend.
Sourcepub fn submit(
&self,
window_id: TeksiloWindowId,
request: FileDialogRequest,
poster: Arc<dyn AppEventPoster>,
on_result: impl FnOnce(FileDialogResult, &mut EventContext<'_>) + 'static,
) -> Result<RequestId, String>
pub fn submit( &self, window_id: TeksiloWindowId, request: FileDialogRequest, poster: Arc<dyn AppEventPoster>, on_result: impl FnOnce(FileDialogResult, &mut EventContext<'_>) + 'static, ) -> Result<RequestId, String>
Submit a request. Validates the request, registers the callback, and asks the backend to dispatch.
on_result runs on the main thread when the OS dialog
completes, or is dropped if window_id’s window closes
first (Self::purge_window).
Returns the RequestId for diagnostics; the caller does
not need to track it for the result to be delivered.
Sourcepub fn deliver(
&self,
payload: FileDialogEventPayload,
ctx: &mut EventContext<'_>,
)
pub fn deliver( &self, payload: FileDialogEventPayload, ctx: &mut EventContext<'_>, )
Deliver a backend-completed payload to its pending callback.
Called by teksilo-app from the AppEvent::External arm. If
the callback was already purged (window closed), the payload
is silently dropped.
Sourcepub fn purge_window(&self, window_id: TeksiloWindowId)
pub fn purge_window(&self, window_id: TeksiloWindowId)
Drop every pending callback whose owning window matches
window_id. Called by teksilo-app’s window-close path so
callbacks capturing widget state cannot fire into a
torn-down tree.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of pending callbacks. Test helper.
Trait Implementations§
Source§impl Clone for FileDialogHandle
impl Clone for FileDialogHandle
Source§fn clone(&self) -> FileDialogHandle
fn clone(&self) -> FileDialogHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for FileDialogHandle
impl !Send for FileDialogHandle
impl !Sync for FileDialogHandle
impl !UnwindSafe for FileDialogHandle
impl Freeze for FileDialogHandle
impl Unpin for FileDialogHandle
impl UnsafeUnpin for FileDialogHandle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.