Struct druid::ExtEventSink
source · pub struct ExtEventSink { /* private fields */ }
Expand description
A thing that can move into other threads and be used to submit commands back to the running application.
This API is preliminary, and may be changed or removed without warning.
Implementations§
source§impl ExtEventSink
impl ExtEventSink
sourcepub fn submit_command<T: Any + Send>(
&self,
selector: Selector<T>,
payload: impl Into<Box<T>>,
target: impl Into<Target>
) -> Result<(), ExtEventError>
pub fn submit_command<T: Any + Send>(
&self,
selector: Selector<T>,
payload: impl Into<Box<T>>,
target: impl Into<Target>
) -> Result<(), ExtEventError>
Submit a Command
to the running application.
Command
is not thread safe, so you cannot submit it directly;
instead you have to pass the Selector
and the payload
separately, and it will be turned into a Command
when it is received.
The payload
must implement Any + Send
.
If the Target::Auto
is equivalent to Target::Global
.
sourcepub fn add_idle_callback<T: 'static + Data>(
&self,
cb: impl FnOnce(&mut T) + Send + 'static
)
pub fn add_idle_callback<T: 'static + Data>(
&self,
cb: impl FnOnce(&mut T) + Send + 'static
)
Schedule an idle callback.
T
must be the application’s root Data
type (the type provided to AppLauncher::launch
).
Add an idle callback, which is called (once) when the message loop is empty. The idle callback will be run from the main UI thread.
Note: the name “idle” suggests that it will be scheduled with a lower priority than other UI events, but that’s not necessarily the case.
Trait Implementations§
source§impl Clone for ExtEventSink
impl Clone for ExtEventSink
source§fn clone(&self) -> ExtEventSink
fn clone(&self) -> ExtEventSink
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more