Skip to main content

from_py_with_required

Function from_py_with_required 

Source
pub fn from_py_with_required<'a, 'py, T>(
    obj: Option<&'a Bound<'py, PyAny>>,
    arg_name: &str,
    extractor: fn(&'a Bound<'py, PyAny>) -> PyResult<T>,
) -> PyResult<T>
Expand description

Fused unwrap + from_py_with, used for required arguments with a #[pyo3(from_py_with)] annotation to keep the generated code small.

As extract_required_argument, the None arm is unreachable but kept as a branch so that this function is safe to call.

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