pub struct PluginFn { /* private fields */ }Expand description
One function a plugin offers to the app’s scripts.
Describes the same thing lumen_script::ScriptFn does in-process: a name,
a namespace, a signature, and a body.
Implementations§
Source§impl PluginFn
impl PluginFn
Sourcepub fn new(name: impl Into<String>) -> PluginFnBuilder
pub fn new(name: impl Into<String>) -> PluginFnBuilder
Start a description. Finish it with
PluginFnBuilder::build.
use lumen_plugin::{PluginFn, ScriptTy, ScriptValue};
let f = PluginFn::new("gpio_read")
.param("pin", ScriptTy::Int)
.ret(ScriptTy::Bool)
.doc("Read a GPIO pin.")
.build(|cx| Ok(ScriptValue::Bool(cx.int_arg(0) % 2 == 0)));Auto Trait Implementations§
impl Freeze for PluginFn
impl !RefUnwindSafe for PluginFn
impl Send for PluginFn
impl Sync for PluginFn
impl Unpin for PluginFn
impl UnsafeUnpin for PluginFn
impl !UnwindSafe for PluginFn
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
§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.