Struct starlark::eval::ParametersSpecBuilder
source · pub struct ParametersSpecBuilder<V> { /* private fields */ }
Expand description
Builder for ParametersSpec
Implementations§
source§impl<V: Copy> ParametersSpecBuilder<V>
impl<V: Copy> ParametersSpecBuilder<V>
sourcepub fn required(&mut self, name: &str)
pub fn required(&mut self, name: &str)
Add a required parameter. Will be an error if the caller doesn’t supply
it. If you want to supply a position-only argument, prepend a $
to
the name.
sourcepub fn optional(&mut self, name: &str)
pub fn optional(&mut self, name: &str)
Add an optional parameter. Will be None if the caller doesn’t supply it.
If you want to supply a position-only argument, prepend a $
to the
name.
sourcepub fn defaulted(&mut self, name: &str, val: V)
pub fn defaulted(&mut self, name: &str, val: V)
Add an optional parameter. Will be the default value if the caller
doesn’t supply it. If you want to supply a position-only argument,
prepend a $
to the name.
sourcepub fn no_more_positional_only_args(&mut self)
pub fn no_more_positional_only_args(&mut self)
Following parameters can be filled positionally or by name.
sourcepub fn no_more_positional_args(&mut self)
pub fn no_more_positional_args(&mut self)
sourcepub fn finish(self) -> ParametersSpec<V>
pub fn finish(self) -> ParametersSpec<V>
Construct the parameters specification.
Auto Trait Implementations§
impl<V> RefUnwindSafe for ParametersSpecBuilder<V>where
V: RefUnwindSafe,
impl<V> Send for ParametersSpecBuilder<V>where
V: Send,
impl<V> Sync for ParametersSpecBuilder<V>where
V: Sync,
impl<V> Unpin for ParametersSpecBuilder<V>where
V: Unpin,
impl<V> UnwindSafe for ParametersSpecBuilder<V>where
V: UnwindSafe,
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