#[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>

source

pub fn new(function_name: String) -> ParametersSpecBuilder<V>

Create a new ParametersSpec with the given function name.

source

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.

source

pub fn signature(&self) -> String

Produce an approximate signature for the function, combining the name and arguments.

source

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>

source

pub fn len(&self) -> usize

Number of function parameters.

source

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.

source

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.

source

pub fn can_fill_with_args(&self, pos: usize, names: &[&str]) -> bool

Check if current parameters can be filled with given arguments signature.

source

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 type
  • parameter_docs should be a mapping of parameter name to possible documentation for that parameter
source

pub fn parser<R, F>( &self, args: &Arguments<'v, '_>, eval: &mut Evaluator<'v, '_>, k: F ) -> Result<R>
where F: FnOnce(ParametersParser<'v, '_>, &mut Evaluator<'v, '_>) -> Result<R>,

Create a ParametersParser for given arguments.

Trait Implementations§

source§

impl<V: Allocative> Allocative for ParametersSpec<V>

source§

fn visit<'allocative_a, 'allocative_b: 'allocative_a>( &self, visitor: &'allocative_a mut Visitor<'allocative_b> )

source§

impl<V: Clone> Clone for ParametersSpec<V>

source§

fn clone(&self) -> ParametersSpec<V>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<V: Debug> Debug for ParametersSpec<V>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<V: Freeze> Freeze for ParametersSpec<V>

§

type Frozen = ParametersSpec<<V as Freeze>::Frozen>

When type is frozen, it is frozen into this type.
source§

fn freeze(self, freezer: &Freezer) -> Result<Self::Frozen>

Freeze a value. The frozen value must be equal to the original, and produce the same hash. Read more
source§

impl<'v, V: Trace<'v>> Trace<'v> for ParametersSpec<V>

source§

fn trace(&mut self, tracer: &Tracer<'v>)

Recursively “trace” the value. Read more
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToAst for T

source§

fn ast(self, begin: usize, end: usize) -> Spanned<Self>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.