#[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_parts<'a>(
function_name: &str,
pos_only: impl IntoIterator<Item = (&'a str, ParametersSpecParam<V>)>,
pos_or_named: impl IntoIterator<Item = (&'a str, ParametersSpecParam<V>)>,
args: bool,
named_only: impl IntoIterator<Item = (&'a str, ParametersSpecParam<V>)>,
kwargs: bool,
) -> ParametersSpec<V>where
V: Copy,
pub fn new_parts<'a>(
function_name: &str,
pos_only: impl IntoIterator<Item = (&'a str, ParametersSpecParam<V>)>,
pos_or_named: impl IntoIterator<Item = (&'a str, ParametersSpecParam<V>)>,
args: bool,
named_only: impl IntoIterator<Item = (&'a str, ParametersSpecParam<V>)>,
kwargs: bool,
) -> ParametersSpec<V>where
V: Copy,
Create a new ParametersSpec
.
Sourcepub fn new_named_only<'a>(
function_name: &str,
named_only: impl IntoIterator<Item = (&'a str, ParametersSpecParam<V>)>,
) -> ParametersSpec<V>where
V: Copy,
pub fn new_named_only<'a>(
function_name: &str,
named_only: impl IntoIterator<Item = (&'a str, ParametersSpecParam<V>)>,
) -> ParametersSpec<V>where
V: Copy,
Parameter parse with only named parameters.
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>
Source§impl<'v, V: ValueLike<'v>> ParametersSpec<V>
impl<'v, V: ValueLike<'v>> ParametersSpec<V>
Sourcepub fn collect_into<const N: usize>(
&self,
args: &Arguments<'v, '_>,
heap: &'v Heap,
) -> Result<[Option<Value<'v>>; N]>
pub fn collect_into<const N: usize>( &self, args: &Arguments<'v, '_>, heap: &'v Heap, ) -> Result<[Option<Value<'v>>; N]>
Collect N
arguments.
This function is called by generated code.
Sourcepub fn collect(
&self,
args: &Arguments<'v, '_>,
slots: &mut [Option<Value<'v>>],
heap: &'v Heap,
) -> Result<()>
pub fn collect( &self, args: &Arguments<'v, '_>, slots: &mut [Option<Value<'v>>], heap: &'v Heap, ) -> Result<()>
Move parameters from Arguments
to a list of Value
,
using the supplied ParametersSpec
.
Sourcepub fn documentation(
&self,
parameter_types: Vec<Ty>,
parameter_docs: HashMap<String, Option<DocString>>,
) -> DocParams
pub fn documentation( &self, parameter_types: Vec<Ty>, parameter_docs: HashMap<String, Option<DocString>>, ) -> DocParams
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
Sourcepub fn parser<R, F>(
&self,
args: &Arguments<'v, '_>,
eval: &mut Evaluator<'v, '_, '_>,
k: F,
) -> Result<R>
pub fn parser<R, F>( &self, args: &Arguments<'v, '_>, eval: &mut Evaluator<'v, '_, '_>, k: F, ) -> Result<R>
Create a ParametersParser
for given arguments.
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.
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 duplicate 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>
Auto Trait Implementations§
impl<V> Freeze for ParametersSpec<V>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more