Skip to main content

FromPython

Trait FromPython 

Source
pub trait FromPython: Sized {
    // Required method
    fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>;
}
Expand description

Trait for converting Python objects to Rust types

Required Methods§

Source

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromPython for bool

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPython for f32

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPython for f64

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPython for i32

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPython for i64

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPython for String

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl<K, V> FromPython for HashMap<K, V>
where K: for<'py> FromPyObject<'py> + Hash + Eq, V: for<'py> FromPyObject<'py>,

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl<T> FromPython for Option<T>
where T: FromPython,

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl<T> FromPython for Vec<T>
where T: for<'py> FromPyObject<'py>,

Source§

fn from_python(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Implementors§