pub struct Registrar { /* private fields */ }Expand description
What a plugin registers into, handed to
RuntimePlugin::register.
Implementations§
Source§impl Registrar
impl Registrar
Sourcepub fn host(&self) -> Host
pub fn host(&self) -> Host
The host, for a plugin that starts a thread while it registers.
A plugin that watches a file, polls a device, or waits on a socket starts doing so here, and the handle it needs to deliver what it finds is this one. It stays valid for the process.
Sourcepub fn script_fn(&mut self, f: PluginFn) -> &mut Self
pub fn script_fn(&mut self, f: PluginFn) -> &mut Self
Offer a function. Registration order is the order the app’s script hosts bind it in, and a later function of the same namespace and name shadows an earlier one.
Sourcepub fn prelude(&mut self, lang: &str, ns: &str, source: &str) -> &mut Self
pub fn prelude(&mut self, lang: &str, ns: &str, source: &str) -> &mut Self
Ship source in lang that the host of that language compiles ahead of
the app’s own program, wrapping the functions registered under ns.
This is how a plugin offers sugar over what it registered: a struct
and an impl block in that language, so a script calls
Gpio::read(pin) rather than the free function.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registrar
impl !RefUnwindSafe for Registrar
impl Send for Registrar
impl Sync for Registrar
impl Unpin for Registrar
impl UnsafeUnpin for Registrar
impl !UnwindSafe for Registrar
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<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().