Type Alias PyUnicode

Source
pub type PyUnicode = PyString;
👎Deprecated since 0.23.0: use PyString instead
Expand description

Deprecated alias for PyString.

Aliased Type§

struct PyUnicode(/* private fields */);

Implementations

Source§

impl PyString

Source

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

Creates a new Python string object.

Panics if out of memory.

Source

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.

Source

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.

Source

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.

Source

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

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

Source

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

👎Deprecated since 0.23.0: renamed to PyString::from_object

Deprecated name for PyString::from_object.

Trait Implementations

Source§

impl AsRef<PyAny> for PyString

Source§

fn as_ref(&self) -> &PyAny

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

impl Deref for PyString

Source§

type Target = PyAny

The resulting type after dereferencing.
Source§

fn deref(&self) -> &PyAny

Dereferences the value.
Source§

impl PyTypeInfo for PyString

Source§

const NAME: &'static str = "PyString"

Class name.
Source§

const MODULE: Option<&'static str>

Module name, if any.
Source§

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

Returns the PyTypeObject instance for this type.
Source§

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.
Source§

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

Returns the safe abstraction over the type object.
Source§

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

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

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

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

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

Checks if object is an instance of this type.
Source§

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.
Source§

impl DerefToPyAny for PyString