Struct starlark::eval::ParametersSpec[][src]

#[repr(C)]
pub struct ParametersSpec<V> { /* fields omitted */ }
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

Create a new ParametersSpec with the given function name.

Create a new ParametersSpec with the given function name and an advance capacity hint.

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.

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.

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.

Add an *args parameter which will be an iterable sequence of parameters, recorded into a Vec. A function can only have one args parameter. After this call, any subsequent required, optional or defaulted parameters can only be supplied by name.

This function has no *args parameter, corresponds to the Python parameter *. After this call, any subsequent required, optional or defaulted parameters can only be supplied by name.

Add a **kwargs parameter which will be a dictionary, recorded into a SmallMap. A function can only have one kwargs parameter. parameter. After this call, any subsequent required, optional or defaulted parameters can only be supplied by position.

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

Move parameters from Arguments to a list of Value, using the supplied ParametersSpec.

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

Create a ParametersParser for given arguments.

Used to freeze a ParametersSpec.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Get an ARef pointing at this type.

Try and get an ARef pointing at this type. Returns an Err if the type Self is a RefCell which is already mutably borrowed. Read more

Return the underlying RefCell if Self is one, otherwise None.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Convert between two equal types.

Convert between references to two equal types.

Convert between mutable references to two equal types.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.