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 = PyClassObject<PyArrowBuffer>
type BaseNativeType = <PyArrowBuffer as PyClassImpl>::BaseNativeType
type Initializer = PyClassInitializer<PyArrowBuffer>
type PyClassMutability = <PyArrowBuffer as PyClassImpl>::PyClassMutability
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§type ThreadChecker = SendablePyClass<PyArrowBuffer>
type ThreadChecker = SendablePyClass<PyArrowBuffer>
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>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<PyArrowBuffer> for PyClassImplCollector<PyArrowBuffer>
impl PyClassNewTextSignature<PyArrowBuffer> for PyClassImplCollector<PyArrowBuffer>
fn new_text_signature(self) -> Option<&'static str>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a PyArrowBuffer
impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a PyArrowBuffer
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§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
Auto Trait Implementations§
impl Freeze for PyArrowBuffer
impl RefUnwindSafe for PyArrowBuffer
impl Send for PyArrowBuffer
impl Sync for PyArrowBuffer
impl Unpin 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> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
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.