pub struct FuncDefBuilder { /* private fields */ }
Expand description
A builder for FuncDef
values.
The builder is created by the .builder()
method of FuncDef
.
See the type-level documentation of FuncDef
and builder method docs for usage examples.
Implementations§
Source§impl FuncDefBuilder
impl FuncDefBuilder
Sourcepub fn param(self, param: ParamType) -> FuncDefBuilder
pub fn param(self, param: ParamType) -> FuncDefBuilder
Sourcepub fn params<I>(self, params: I) -> FuncDefBuilderwhere
I: IntoIterator<Item = ParamType>,
pub fn params<I>(self, params: I) -> FuncDefBuilderwhere
I: IntoIterator<Item = ParamType>,
Adds function parameters from an iterator.
Calls to .params()
and .param()
can be mixed and will always add more parameters to
the function definition instead of overwriting existing ones.
§Examples
let func_def = FuncDef::builder()
.params([
ParamType::Number,
ParamType::Number,
ParamType::Number,
])
.build(add3);
Sourcepub fn variadic_param(self, param: ParamType) -> FuncDefBuilder
pub fn variadic_param(self, param: ParamType) -> FuncDefBuilder
Adds a variadic parameter to the function definition.
Only one variadic parameter can be added. Subsequent invocation of this method will overwrite a previously set variadic parameter.
§Examples
let func_def = FuncDef::builder()
.param(ParamType::String)
.variadic_param(ParamType::Any)
.build(printf);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FuncDefBuilder
impl RefUnwindSafe for FuncDefBuilder
impl Send for FuncDefBuilder
impl Sync for FuncDefBuilder
impl Unpin for FuncDefBuilder
impl UnwindSafe for FuncDefBuilder
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