Struct pyo3::impl_::extract_argument::FunctionDescription

source ·
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

source

fn full_name(&self) -> String

source

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>,

Available on non-Py_LIMITED_API only.

Equivalent of extract_arguments_tuple_dict which uses the Python C-API “fastcall” convention.

§Safety
  • args must be a pointer to a C-style array of valid ffi::PyObject pointers, or NULL.
  • kwnames must be a pointer to a PyTuple, or NULL.
  • nargs + kwnames.len() is the total length of the args array.
source

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
  • args must be a pointer to a PyTuple.
  • kwargs must be a pointer to a PyDict, or NULL.
source

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>)>,

source

fn find_keyword_parameter_in_positional( &self, kwarg_name: &str ) -> Option<usize>

source

fn find_keyword_parameter_in_keyword_only( &self, kwarg_name: &str ) -> Option<usize>

source

fn ensure_no_missing_required_positional_arguments( &self, output: &[Option<Borrowed<'_, '_, PyAny>>], positional_args_provided: usize ) -> PyResult<()>

source

fn ensure_no_missing_required_keyword_arguments( &self, output: &[Option<Borrowed<'_, '_, PyAny>>] ) -> PyResult<()>

source

fn too_many_positional_arguments(&self, args_provided: usize) -> PyErr

source

fn multiple_values_for_argument(&self, argument: &str) -> PyErr

source

fn unexpected_keyword_argument( &self, argument: Borrowed<'_, '_, PyAny> ) -> PyErr

source

fn positional_only_keyword_arguments(&self, parameter_names: &[&str]) -> PyErr

source

fn missing_required_arguments( &self, argument_type: &str, parameter_names: &[&str] ) -> PyErr

source

fn missing_required_keyword_arguments( &self, keyword_outputs: &[Option<Borrowed<'_, '_, PyAny>>] ) -> PyErr

source

fn missing_required_positional_arguments( &self, output: &[Option<Borrowed<'_, '_, PyAny>>] ) -> PyErr

Auto Trait Implementations§

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> AssertNotZeroSized for T

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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

impl<T> SomeWrap<T> for T

source§

fn wrap(self) -> Option<T>

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.
source§

impl<T> Ungil for T
where T: Send,

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here