pub struct FunctionDescription {
    pub cls_name: Option<&'static str>,
    pub func_name: &'static str,
    pub positional_parameter_names: &'static [&'static str],
    pub positional_only_parameters: usize,
    pub required_positional_parameters: usize,
    pub keyword_only_parameters: &'static [KeywordOnlyParameterDescription],
}Expand description
Function argument specification for a #[pyfunction] or #[pymethod].
Fields§
§cls_name: Option<&'static str>§func_name: &'static str§positional_parameter_names: &'static [&'static str]§positional_only_parameters: usize§required_positional_parameters: usize§keyword_only_parameters: &'static [KeywordOnlyParameterDescription]Implementations§
Source§impl FunctionDescription
 
impl FunctionDescription
fn full_name(&self) -> String
Sourcepub unsafe fn extract_arguments_fastcall<'py, V, K>(
    &self,
    py: Python<'py>,
    args: *const *mut PyObject,
    nargs: Py_ssize_t,
    kwnames: *mut PyObject,
    output: &mut [Option<Borrowed<'py, 'py, PyAny>>],
) -> PyResult<(V::Varargs, K::Varkeywords)>where
    V: VarargsHandler<'py>,
    K: VarkeywordsHandler<'py>,
 Available on Py_3_10 or non-Py_LIMITED_API only.
pub unsafe fn extract_arguments_fastcall<'py, V, K>(
    &self,
    py: Python<'py>,
    args: *const *mut PyObject,
    nargs: Py_ssize_t,
    kwnames: *mut PyObject,
    output: &mut [Option<Borrowed<'py, 'py, PyAny>>],
) -> PyResult<(V::Varargs, K::Varkeywords)>where
    V: VarargsHandler<'py>,
    K: VarkeywordsHandler<'py>,
Py_3_10 or non-Py_LIMITED_API only.Equivalent of extract_arguments_tuple_dict which uses the Python C-API “fastcall” convention.
§Safety
- argsmust be a pointer to a C-style array of valid- ffi::PyObjectpointers, or NULL.
- kwnamesmust be a pointer to a PyTuple, or NULL.
- nargs + kwnames.len()is the total length of the- argsarray.
Sourcepub unsafe fn extract_arguments_tuple_dict<'py, V, K>(
    &self,
    py: Python<'py>,
    args: *mut PyObject,
    kwargs: *mut PyObject,
    output: &mut [Option<Borrowed<'py, 'py, PyAny>>],
) -> PyResult<(V::Varargs, K::Varkeywords)>where
    V: VarargsHandler<'py>,
    K: VarkeywordsHandler<'py>,
 
pub unsafe fn extract_arguments_tuple_dict<'py, V, K>(
    &self,
    py: Python<'py>,
    args: *mut PyObject,
    kwargs: *mut PyObject,
    output: &mut [Option<Borrowed<'py, 'py, PyAny>>],
) -> PyResult<(V::Varargs, K::Varkeywords)>where
    V: VarargsHandler<'py>,
    K: VarkeywordsHandler<'py>,
Extracts the args and kwargs provided into output, according to this function
definition.
output must have the same length as this function has positional and keyword-only
parameters (as per the positional_parameter_names and keyword_only_parameters
respectively).
Unexpected, duplicate or invalid arguments will cause this function to return TypeError.
§Safety
- argsmust be a pointer to a PyTuple.
- kwargsmust be a pointer to a PyDict, or NULL.
fn handle_kwargs<'py, K, I>(
    &self,
    kwargs: I,
    varkeywords: &mut K::Varkeywords,
    num_positional_parameters: usize,
    output: &mut [Option<Borrowed<'py, 'py, PyAny>>],
) -> PyResult<()>where
    K: VarkeywordsHandler<'py>,
    I: IntoIterator<Item = (Borrowed<'py, 'py, PyAny>, Borrowed<'py, 'py, PyAny>)>,
fn find_keyword_parameter_in_positional( &self, kwarg_name: &str, ) -> Option<usize>
fn find_keyword_parameter_in_keyword_only( &self, kwarg_name: &str, ) -> Option<usize>
fn ensure_no_missing_required_positional_arguments( &self, output: &[Option<Borrowed<'_, '_, PyAny>>], positional_args_provided: usize, ) -> PyResult<()>
fn ensure_no_missing_required_keyword_arguments( &self, output: &[Option<Borrowed<'_, '_, PyAny>>], ) -> PyResult<()>
fn too_many_positional_arguments(&self, args_provided: usize) -> PyErr
fn multiple_values_for_argument(&self, argument: &str) -> PyErr
fn unexpected_keyword_argument( &self, argument: Borrowed<'_, '_, PyAny>, ) -> PyErr
fn positional_only_keyword_arguments(&self, parameter_names: &[&str]) -> PyErr
fn missing_required_arguments( &self, argument_type: &str, parameter_names: &[&str], ) -> PyErr
fn missing_required_keyword_arguments( &self, keyword_outputs: &[Option<Borrowed<'_, '_, PyAny>>], ) -> PyErr
fn missing_required_positional_arguments( &self, output: &[Option<Borrowed<'_, '_, PyAny>>], ) -> PyErr
Auto Trait Implementations§
impl Freeze for FunctionDescription
impl RefUnwindSafe for FunctionDescription
impl Send for FunctionDescription
impl Sync for FunctionDescription
impl Unpin for FunctionDescription
impl UnwindSafe for FunctionDescription
Blanket Implementations§
Source§impl<T> AssertNotZeroSized for T
 
impl<T> AssertNotZeroSized for T
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> 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 moreSource§impl<T> SizedTypeProperties for T
 
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
 
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)] const LAYOUT: Layout = _
 
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
 
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)The largest safe length for a 
[Self]. Read more