Struct cpython::PyBytes [] [src]

pub struct PyBytes(_);

Represents a Python byte string. Corresponds to str in Python 2, and bytes in Python 3.

Methods

impl PyBytes
[src]

[src]

Creates a new Python byte string object. The byte string is initialized by copying the data from the &[u8].

Panics if out of memory.

[src]

Gets the Python string data as byte slice.

Trait Implementations

impl ToPyObject for PyBytes
[src]

Identity conversion: allows using existing PyObject instances where T: ToPyObject is expected.

[src]

Converts self into a Python object.

[src]

Converts self into a Python object. Read more

[src]

Converts self into a Python object and calls the specified closure on the native FFI pointer underlying the Python object. Read more

impl<'source> FromPyObject<'source> for PyBytes
[src]

[src]

Extracts Self from the source PyObject.

impl<'source> FromPyObject<'source> for &'source PyBytes
[src]

[src]

Extracts Self from the source PyObject.

impl PythonObject for PyBytes
[src]

[src]

Casts the Python object to PyObject.

[src]

Casts the Python object to PyObject.

[src]

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

[src]

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

impl PythonObjectWithCheckedDowncast for PyBytes
[src]

[src]

Cast from PyObject to a concrete Python object type.

[src]

Cast from PyObject to a concrete Python object type.

impl PythonObjectWithTypeObject for PyBytes
[src]

[src]

Retrieves the type object for this Python object type.