pub struct Host { /* private fields */ }Expand description
The engine, as a plugin can reach it.
Cheap to clone and usable from any thread, so a plugin keeps one in a worker and pushes at the app whenever it has something. Nothing here blocks on the tick thread: a call queues its payload and returns.
Implementations§
Source§impl Host
impl Host
Sourcepub fn call_handler(
&self,
event: &str,
key: &str,
fallback: &str,
args: Vec<ScriptValue>,
) -> bool
pub fn call_handler( &self, event: &str, key: &str, fallback: &str, args: Vec<ScriptValue>, ) -> bool
Call a handler in the app’s script.
event is the handler name, key the identifier it receives so one
handler can serve several sources, and fallback a handler to try
when the app defines no event (empty for none).
Returns false when the engine is no longer taking events, which is what a plugin’s worker thread sees while the app shuts down.
Sourcepub fn emit(&self, commands: Vec<ScriptCommand>) -> bool
pub fn emit(&self, commands: Vec<ScriptCommand>) -> bool
Apply commands, as if a call had emitted them.
Returns false when the engine is no longer taking events.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Host
impl RefUnwindSafe for Host
impl Send for Host
impl Sync for Host
impl Unpin for Host
impl UnsafeUnpin for Host
impl UnwindSafe for Host
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.