Skip to main content

FromPyArrow

Trait FromPyArrow 

Source
pub trait FromPyArrow: Sized {
    const INPUT_TYPE: PyStaticExpr = _;

    // Required method
    fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>;
}
Expand description

Trait for converting Python objects to arrow-rs types.

Provided Associated Constants§

Source

const INPUT_TYPE: PyStaticExpr = _

The Python type this conversion accepts, as a type hint.

Used by [FromPyObject::INPUT_TYPE] on PyArrowType so that a stub generator can write pyarrow.Array where it would otherwise write _typeshed.Incomplete.

This names pyarrow classes only. Every conversion here also accepts any object implementing the relevant PyCapsule interface method, which is duck-typed and has no canonical Python type to point at — neither pyarrow nor typeshed defines one. The hint is therefore narrower than what is accepted at runtime. A binding that wants to advertise the wider protocol can declare its own Protocol and carry it on a newtype around the arrow-rs type.

Required Methods§

Source

fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>

Convert a Python object to an arrow-rs type.

Takes a GIL-bound value from Python and returns a result with the arrow-rs type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FromPyArrow for ArrayData

Source§

const INPUT_TYPE: PyStaticExpr

Source§

fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPyArrow for ArrowArrayStreamReader

Supports conversion from pyarrow.RecordBatchReader to [ArrowArrayStreamReader].

Source§

const INPUT_TYPE: PyStaticExpr = ARRAY_STREAM_INPUT_TYPE

Source§

fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPyArrow for DataType

Source§

const INPUT_TYPE: PyStaticExpr

Source§

fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPyArrow for Field

Source§

const INPUT_TYPE: PyStaticExpr

Source§

fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPyArrow for RecordBatch

Source§

const INPUT_TYPE: PyStaticExpr

Source§

fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl FromPyArrow for Schema

Source§

const INPUT_TYPE: PyStaticExpr

Source§

fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>

Source§

impl<T: FromPyArrow> FromPyArrow for Vec<T>

Source§

const INPUT_TYPE: PyStaticExpr

Source§

fn from_pyarrow_bound(value: &Bound<'_, PyAny>) -> PyResult<Self>

Implementors§

Source§

impl FromPyArrow for Table

Convert a pyarrow.Table (or any other ArrowArrayStream compliant object) into Table

Source§

const INPUT_TYPE: PyStaticExpr = ARRAY_STREAM_INPUT_TYPE