Struct pyo3::PyByteArray [−][src]
pub struct PyByteArray(_);
Represents a Python bytearray.
Methods
impl PyByteArray[src]
impl PyByteArraypub fn new<'p>(py: Python<'p>, src: &[u8]) -> &'p PyByteArray[src]
pub fn new<'p>(py: Python<'p>, src: &[u8]) -> &'p PyByteArrayCreates a new Python bytearray object.
The byte string is initialized by copying the data from the &[u8].
Panics if out of memory.
pub fn from<'p, I>(py: Python<'p>, src: &'p I) -> PyResult<&'p PyByteArray> where
I: ToPyPointer, [src]
pub fn from<'p, I>(py: Python<'p>, src: &'p I) -> PyResult<&'p PyByteArray> where
I: ToPyPointer, Creates a new Python bytearray object from other PyObject, that implements the buffer protocol.
pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizeGets the length of the bytearray.
pub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> boolCheck if bytearray is empty.
pub fn data(&self) -> &mut [u8][src]
pub fn data(&self) -> &mut [u8]Gets the Python bytearray data as byte slice.
pub fn resize(&self, len: usize) -> PyResult<()>[src]
pub fn resize(&self, len: usize) -> PyResult<()>Resize bytearray object.
Trait Implementations
impl<'a> From<&'a PyByteArray> for &'a PyObjectRef[src]
impl<'a> From<&'a PyByteArray> for &'a PyObjectReffn from(ob: &'a PyByteArray) -> Self[src]
fn from(ob: &'a PyByteArray) -> SelfPerforms the conversion.
impl AsRef<PyObjectRef> for PyByteArray[src]
impl AsRef<PyObjectRef> for PyByteArrayfn as_ref(&self) -> &PyObjectRef[src]
fn as_ref(&self) -> &PyObjectRefPerforms the conversion.
impl PyObjectWithToken for PyByteArray[src]
impl PyObjectWithToken for PyByteArrayimpl ToPyPointer for PyByteArray[src]
impl ToPyPointer for PyByteArrayimpl PartialEq for PyByteArray[src]
impl PartialEq for PyByteArrayfn eq(&self, o: &PyByteArray) -> bool[src]
fn eq(&self, o: &PyByteArray) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl PyTypeInfo for PyByteArray[src]
impl PyTypeInfo for PyByteArraytype Type = ()
Type of objects to store in PyObject struct
type BaseType = PyObjectRef
Base class
const NAME: &'static str
NAME: &'static str = "PyByteArray"
Class name
const SIZE: usize
SIZE: usize = ::std::mem::size_of::<::ffi::PyObject>()
Size of the rust PyObject structure (PyObject + rust structure)
const OFFSET: isize
OFFSET: isize = 0
Type instance offset inside PyObject structure
unsafe fn type_object() -> &'static mut PyTypeObject[src]
unsafe fn type_object() -> &'static mut PyTypeObjectPyTypeObject instance for this type
fn is_instance(ptr: *mut PyObject) -> bool[src]
fn is_instance(ptr: *mut PyObject) -> boolCheck if *mut ffi::PyObject is instance of this type
const DESCRIPTION: &'static str
DESCRIPTION: &'static str = "\u{0}"
Class doc string
const FLAGS: usize
FLAGS: usize = 0
Type flags (ie PY_TYPE_FLAG_GC, PY_TYPE_FLAG_WEAKREF)
fn is_exact_instance(ptr: *mut PyObject) -> bool[src]
fn is_exact_instance(ptr: *mut PyObject) -> boolCheck if *mut ffi::PyObject is exact instance of this type
impl PyTypeObject for PyByteArray[src]
impl PyTypeObject for PyByteArrayfn init_type()[src]
fn init_type()Initialize type object
fn type_object() -> Py<PyType>[src]
fn type_object() -> Py<PyType>Retrieves the type object for this Python object type.
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo, [src]
fn create(py: Python) -> PyResult<PyRawObject> where
Self: Sized + PyObjectAlloc<Self> + PyTypeInfo, Create PyRawObject which can be initialized with rust value
impl ToPyObject for PyByteArray[src]
impl ToPyObject for PyByteArrayimpl ToBorrowedObject for PyByteArray[src]
impl ToBorrowedObject for PyByteArrayfn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R, [src]
fn with_borrowed_ptr<F, R>(&self, _py: Python, f: F) -> R where
F: FnOnce(*mut PyObject) -> R, Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more
impl Debug for PyByteArray[src]
impl Debug for PyByteArrayfn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl Display for PyByteArray[src]
impl Display for PyByteArrayfn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>Formats the value using the given formatter. Read more
impl<'a> FromPyObject<'a> for &'a PyByteArray[src]
impl<'a> FromPyObject<'a> for &'a PyByteArrayfn extract(ob: &'a PyObjectRef) -> PyResult<Self>[src]
fn extract(ob: &'a PyObjectRef) -> PyResult<Self>Extracts Self from the source PyObject.
Auto Trait Implementations
impl Send for PyByteArray
impl Send for PyByteArrayimpl Sync for PyByteArray
impl Sync for PyByteArray