Type Alias PyUnicode
pub type PyUnicode = PyString;
👎Deprecated since 0.23.0: use
PyString
insteadAvailable on crate features
dep_pyo3
and std
only.Expand description
Deprecated alias for PyString
.
Aliased Type§
struct PyUnicode(/* private fields */);
Implementations
§impl PyString
impl PyString
pub fn new<'py>(py: Python<'py>, s: &str) -> Bound<'py, 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
pub fn new_bound<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString>
PyString::new
Deprecated name for PyString::new
.
pub fn intern<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString>
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
pub fn intern_bound<'py>(py: Python<'py>, s: &str) -> Bound<'py, PyString>
PyString::intern
Deprecated name for PyString::intern
.
Trait Implementations
§impl PyTypeInfo for PyString
impl PyTypeInfo for PyString
§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
§fn is_type_of_bound(obj: &Bound<'_, PyAny>) -> bool
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>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
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
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
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
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
.