Struct starlark::eval::ParametersSpec
source · #[repr(C)]pub struct ParametersSpec<V> { /* private fields */ }
Expand description
Define a list of parameters. This code assumes that all names are distinct and that
*args
/**kwargs
occur in well-formed locations.
Implementations§
source§impl<V> ParametersSpec<V>
impl<V> ParametersSpec<V>
sourcepub fn new(function_name: String) -> ParametersSpecBuilder<V>
pub fn new(function_name: String) -> ParametersSpecBuilder<V>
Create a new ParametersSpec
with the given function name.
sourcepub fn with_capacity(
function_name: String,
capacity: usize
) -> ParametersSpecBuilder<V>
pub fn with_capacity( function_name: String, capacity: usize ) -> ParametersSpecBuilder<V>
Create a new ParametersSpec
with the given function name and an advance capacity hint.
sourcepub fn signature(&self) -> String
pub fn signature(&self) -> String
Produce an approximate signature for the function, combining the name and arguments.
sourcepub fn parameters_str(&self) -> String
pub fn parameters_str(&self) -> String
Function parameter as they would appear in def
(excluding types, default values and formatting).
source§impl<'v, V: ValueLike<'v>> ParametersSpec<V>
impl<'v, V: ValueLike<'v>> ParametersSpec<V>
sourcepub fn collect(
&self,
args: &Arguments<'v, '_>,
slots: &[Cell<Option<Value<'v>>>],
heap: &'v Heap
) -> Result<()>
pub fn collect( &self, args: &Arguments<'v, '_>, slots: &[Cell<Option<Value<'v>>>], heap: &'v Heap ) -> Result<()>
Move parameters from Arguments
to a list of Value
,
using the supplied ParametersSpec
.
sourcepub fn collect_into<const N: usize>(
&self,
args: &Arguments<'v, '_>,
heap: &'v Heap
) -> Result<[Cell<Option<Value<'v>>>; N]>
pub fn collect_into<const N: usize>( &self, args: &Arguments<'v, '_>, heap: &'v Heap ) -> Result<[Cell<Option<Value<'v>>>; N]>
Collect N
arguments.
This function is called by generated code.
sourcepub fn can_fill_with_args(&self, pos: usize, names: &[&str]) -> bool
pub fn can_fill_with_args(&self, pos: usize, names: &[&str]) -> bool
Check if current parameters can be filled with given arguments signature.
sourcepub fn documentation(
&self,
parameter_types: Vec<Ty>,
parameter_docs: HashMap<String, Option<DocString>>
) -> Vec<DocParam>
pub fn documentation( &self, parameter_types: Vec<Ty>, parameter_docs: HashMap<String, Option<DocString>> ) -> Vec<DocParam>
Generate documentation for each of the parameters.
§Arguments
parameter_types
should be a mapping of parameter index to typeparameter_docs
should be a mapping of parameter name to possible documentation for that parameter
Trait Implementations§
source§impl<V: Allocative> Allocative for ParametersSpec<V>
impl<V: Allocative> Allocative for ParametersSpec<V>
source§impl<V: Clone> Clone for ParametersSpec<V>
impl<V: Clone> Clone for ParametersSpec<V>
source§fn clone(&self) -> ParametersSpec<V>
fn clone(&self) -> ParametersSpec<V>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<V: Debug> Debug for ParametersSpec<V>
impl<V: Debug> Debug for ParametersSpec<V>
source§impl<V: Freeze> Freeze for ParametersSpec<V>
impl<V: Freeze> Freeze for ParametersSpec<V>
source§impl<'v, V: Trace<'v>> Trace<'v> for ParametersSpec<V>
impl<'v, V: Trace<'v>> Trace<'v> for ParametersSpec<V>
impl<From: Coerce<To>, To> Coerce<ParametersSpec<To>> for ParametersSpec<From>
Auto Trait Implementations§
impl<V> RefUnwindSafe for ParametersSpec<V>where
V: RefUnwindSafe,
impl<V> Send for ParametersSpec<V>where
V: Send,
impl<V> Sync for ParametersSpec<V>where
V: Sync,
impl<V> Unpin for ParametersSpec<V>
impl<V> UnwindSafe for ParametersSpec<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