Skip to main content

extract_required_argument

Function extract_required_argument 

Source
pub fn extract_required_argument<'a, 'holder, 'py, T, const IMPLEMENTS_FROMPYOBJECT: bool>(
    obj: Option<Borrowed<'a, 'py, PyAny>>,
    holder: &'holder mut T::Holder,
    arg_name: &str,
) -> PyResult<T>
where T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
Expand description

Fused unwrap + extract_argument, used for required arguments to keep the generated code small.

The macro-generated caller guarantees obj is Some (the FunctionDescription extract_arguments_ methods check that all required arguments are provided); the None arm is unreachable but kept as a branch so that this function is safe to call (avoiding an unsafe block in the generated code).

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