pub struct PyArrowBuffer(/* private fields */);Expand description
A wrapper around an Arrow Buffer.
This implements both import and export via the Python buffer protocol.
§Buffer import
This can be very useful as a general way to support ingest of a Python buffer protocol object. The underlying Arrow Buffer manages the external memory, automatically calling the Python buffer’s release callback when the Arrow Buffer reference count reaches 0.
This does not need to be used with Arrow at all! This can be used with any API where you want
to handle both Python-provided and Rust-provided buffers. PyArrowBuffer implements
AsRef<[u8]>.
§Buffer export
The Python buffer protocol is implemented on this buffer to enable zero-copy data transfer of
the core buffer into Python. This allows for zero-copy data sharing with numpy via
numpy.frombuffer.
Implementations§
Source§impl PyArrowBuffer
impl PyArrowBuffer
Sourcepub fn new(buffer: Buffer) -> Self
pub fn new(buffer: Buffer) -> Self
Construct a new PyArrowBuffer
Sourcepub fn into_inner(self) -> Buffer
pub fn into_inner(self) -> Buffer
Consume and return the Buffer
Trait Implementations§
Source§impl AsRef<[u8]> for PyArrowBuffer
impl AsRef<[u8]> for PyArrowBuffer
Source§impl AsRef<Buffer> for PyArrowBuffer
impl AsRef<Buffer> for PyArrowBuffer
Source§impl<'py> FromPyObject<'_, 'py> for PyArrowBuffer
impl<'py> FromPyObject<'_, 'py> for PyArrowBuffer
Source§impl<'py> IntoPyObject<'py> for PyArrowBuffer
impl<'py> IntoPyObject<'py> for PyArrowBuffer
Source§type Target = PyArrowBuffer
type Target = PyArrowBuffer
Source§type Output = Bound<'py, <PyArrowBuffer as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PyArrowBuffer as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for PyArrowBuffer
impl PyClass for PyArrowBuffer
Source§impl PyClassBaseType for PyArrowBuffer
impl PyClassBaseType for PyArrowBuffer
type LayoutAsBase = <PyArrowBuffer as PyClassImpl>::Layout
type BaseNativeType = <PyArrowBuffer as PyClassImpl>::BaseNativeType
type Initializer = PyClassInitializer<PyArrowBuffer>
type PyClassMutability = <PyArrowBuffer as PyClassImpl>::PyClassMutability
Source§type Layout<T: PyClassImpl> = <<PyArrowBuffer as PyClassBaseType>::BaseNativeType as PyClassBaseType>::Layout<T>
type Layout<T: PyClassImpl> = <<PyArrowBuffer as PyClassBaseType>::BaseNativeType as PyClassBaseType>::Layout<T>
Source§impl PyClassImpl for PyArrowBuffer
impl PyClassImpl for PyArrowBuffer
Source§const IS_BASETYPE: bool = true
const IS_BASETYPE: bool = true
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// A wrapper around an Arrow [Buffer].
///
/// This implements both import and export via the Python buffer protocol.
///
/// ### Buffer import
///
/// This can be very useful as a general way to support ingest of a Python buffer protocol object.
/// The underlying Arrow [Buffer] manages the external memory, automatically calling the Python
/// buffer's release callback when the Arrow [Buffer] reference count reaches 0.
///
/// This does not need to be used with Arrow at all! This can be used with any API where you want
/// to handle both Python-provided and Rust-provided buffers. [`PyArrowBuffer`] implements
/// `AsRef<[u8]>`.
///
/// ### Buffer export
///
/// The Python buffer protocol is implemented on this buffer to enable zero-copy data transfer of
/// the core buffer into Python. This allows for zero-copy data sharing with numpy via
/// `numpy.frombuffer`.
const RAW_DOC: &'static CStr = /// A wrapper around an Arrow [Buffer]. /// /// This implements both import and export via the Python buffer protocol. /// /// ### Buffer import /// /// This can be very useful as a general way to support ingest of a Python buffer protocol object. /// The underlying Arrow [Buffer] manages the external memory, automatically calling the Python /// buffer's release callback when the Arrow [Buffer] reference count reaches 0. /// /// This does not need to be used with Arrow at all! This can be used with any API where you want /// to handle both Python-provided and Rust-provided buffers. [`PyArrowBuffer`] implements /// `AsRef<[u8]>`. /// /// ### Buffer export /// /// The Python buffer protocol is implemented on this buffer to enable zero-copy data transfer of /// the core buffer into Python. This allows for zero-copy data sharing with numpy via /// `numpy.frombuffer`.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<PyArrowBuffer as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<PyArrowBuffer>
type Layout = <<PyArrowBuffer as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<PyArrowBuffer>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
Source§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
Source§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyClassNewTextSignature for PyArrowBuffer
impl PyClassNewTextSignature for PyArrowBuffer
const TEXT_SIGNATURE: &'static str = "(buf)"
Source§impl PyMethods<PyArrowBuffer> for PyClassImplCollector<PyArrowBuffer>
impl PyMethods<PyArrowBuffer> for PyClassImplCollector<PyArrowBuffer>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for PyArrowBuffer
impl PyTypeInfo for PyArrowBuffer
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
::type_object(py).name() to get the correct runtime valueSource§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
::type_object(py).module() to get the correct runtime valueSource§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
impl DerefToPyAny for PyArrowBuffer
impl ExtractPyClassWithClone for PyArrowBuffer
Auto Trait Implementations§
impl Freeze for PyArrowBuffer
impl RefUnwindSafe for PyArrowBuffer
impl Send for PyArrowBuffer
impl Sync for PyArrowBuffer
impl Unpin for PyArrowBuffer
impl UnsafeUnpin for PyArrowBuffer
impl UnwindSafe for PyArrowBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.