pub struct ScriptHostAccess {
pub signal: fn(&World, &str) -> Option<ScriptValue>,
pub call: fn(&mut World, &str) -> Result<Option<ScriptValue>, ScriptError>,
pub exports: fn(&World) -> Vec<String>,
}Expand description
Reaching an installed host, in the terms a caller asks in.
Every entry resolves the host resource itself, so the app owns no borrow of it between calls.
Fields§
§signal: fn(&World, &str) -> Option<ScriptValue>The value the script last wrote to a signal, from the host’s mirror.
call: fn(&mut World, &str) -> Result<Option<ScriptValue>, ScriptError>Call an exported function with no arguments, returning what it returned when the host has such a function.
exports: fn(&World) -> Vec<String>The names a caller may call.
Implementations§
Source§impl ScriptHostAccess
impl ScriptHostAccess
Sourcepub fn absent() -> Self
pub fn absent() -> Self
The table an app with no script answers through: every entry reports nothing rather than the caller having to ask whether there is a host.
Sourcepub fn of<H>(exports: fn(&World) -> Vec<String>) -> Selfwhere
H: ScriptHost + Resource<Mutability = Mutable>,
pub fn of<H>(exports: fn(&World) -> Vec<String>) -> Selfwhere
H: ScriptHost + Resource<Mutability = Mutable>,
The table for a host stored as the resource H. exports is the
host’s own rule for what a caller may call: ScriptHost carries no
export list, so a host without one answers with an empty list.
Trait Implementations§
Source§impl Clone for ScriptHostAccess
impl Clone for ScriptHostAccess
Source§fn clone(&self) -> ScriptHostAccess
fn clone(&self) -> ScriptHostAccess
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ScriptHostAccess
Auto Trait Implementations§
impl Freeze for ScriptHostAccess
impl RefUnwindSafe for ScriptHostAccess
impl Send for ScriptHostAccess
impl Sync for ScriptHostAccess
impl Unpin for ScriptHostAccess
impl UnsafeUnpin for ScriptHostAccess
impl UnwindSafe for ScriptHostAccess
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.