Type Alias PyUnicode

pub type PyUnicode = PyString;
👎Deprecated since 0.23.0: use PyString instead
Available on crate features dep_pyo3 and std only.
Expand description

Deprecated alias for PyString.

Aliased Type§

struct PyUnicode(/* private fields */);

Implementations

§

impl PyString

pub fn new<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString>

Creates a new Python string object.

Panics if out of memory.

pub fn new_bound<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString>

👎Deprecated since 0.23.0: renamed to PyString::new

Deprecated name for PyString::new.

pub fn intern<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString>

Intern the given string

This will return a reference to the same Python string object if called repeatedly with the same string.

Note that while this is more memory efficient than PyString::new_bound, it unconditionally allocates a temporary Python string object and is thereby slower than PyString::new_bound.

Panics if out of memory.

pub fn intern_bound<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString>

👎Deprecated since 0.23.0: renamed to PyString::intern

Deprecated name for PyString::intern.

pub fn from_object<'py>( src: &Bound<'py, PyAny>, encoding: &str, errors: &str, ) -> Result<Bound<'py, PyString>, PyErr>

Attempts to create a Python string from a Python bytes-like object.

pub fn from_object_bound<'py>( src: &Bound<'py, PyAny>, encoding: &str, errors: &str, ) -> Result<Bound<'py, PyString>, PyErr>

👎Deprecated since 0.23.0: renamed to PyString::from_object

Deprecated name for PyString::from_object.

Trait Implementations

§

impl AsRef<PyAny> for PyString

§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
§

impl Deref for PyString

§

type Target = PyAny

The resulting type after dereferencing.
§

fn deref(&self) -> &PyAny

Dereferences the value.
§

impl PyTypeInfo for PyString

§

const NAME: &'static str = "PyString"

Class name.
§

const MODULE: Option<&'static str>

Module name, if any.
§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
§

fn is_type_of_bound(obj: &Bound<'_, PyAny>) -> bool

👎Deprecated since 0.23.0: renamed to PyTypeInfo::is_type_of
Deprecated name for PyTypeInfo::is_type_of.
§

fn type_object(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

👎Deprecated since 0.23.0: renamed to PyTypeInfo::type_object
Deprecated name for PyTypeInfo::type_object.
§

fn is_type_of(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
§

fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.
§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

👎Deprecated since 0.23.0: renamed to PyTypeInfo::is_exact_type_of
Deprecated name for PyTypeInfo::is_exact_type_of.
§

impl DerefToPyAny for PyString