pub struct ScriptFnBuilder { /* private fields */ }Expand description
Builder for a typed ScriptFn. Start it with ScriptFn::new.
Implementations§
Source§impl ScriptFnBuilder
impl ScriptFnBuilder
Sourcepub fn param(self, name: impl Into<String>, ty: ScriptTy) -> Self
pub fn param(self, name: impl Into<String>, ty: ScriptTy) -> Self
Append a required parameter. Call in argument order.
Sourcepub fn ret(self, ty: ScriptTy) -> Self
pub fn ret(self, ty: ScriptTy) -> Self
Set the return type. Defaults to ScriptTy::Any, which reads as a
return nobody declared; a function whose result really is open declares
ScriptTy::Dynamic.
Sourcepub fn doc(self, doc: impl Into<String>) -> Self
pub fn doc(self, doc: impl Into<String>) -> Self
Set the one-line description editor tooling shows.
Sourcepub fn ns(self, ns: ScriptNs) -> Self
pub fn ns(self, ns: ScriptNs) -> Self
Choose the namespace. Defaults to ScriptNs::Extension.
Sourcepub fn min_arity(self, min_arity: usize) -> Self
pub fn min_arity(self, min_arity: usize) -> Self
Make the trailing parameters optional: a call may pass as few as
min_arity arguments, and the body reads the rest as
ScriptValue::Unit.
Auto Trait Implementations§
impl Freeze for ScriptFnBuilder
impl RefUnwindSafe for ScriptFnBuilder
impl Send for ScriptFnBuilder
impl Sync for ScriptFnBuilder
impl Unpin for ScriptFnBuilder
impl UnsafeUnpin for ScriptFnBuilder
impl UnwindSafe for ScriptFnBuilder
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.