pub type PyUnicode = PyString;
👎Deprecated since 0.23.0: use
PyString
insteadExpand description
Deprecated alias for PyString
.
Aliased Type§
struct PyUnicode(/* private fields */);
Implementations
Source§impl PyString
impl PyString
Sourcepub 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.
Sourcepub 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
.
Sourcepub 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.
Sourcepub 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
.
Sourcepub fn from_object<'py>(
src: &Bound<'py, PyAny>,
encoding: &str,
errors: &str,
) -> PyResult<Bound<'py, PyString>>
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.
Sourcepub 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
pub fn from_object_bound<'py>( src: &Bound<'py, PyAny>, encoding: &str, errors: &str, ) -> PyResult<Bound<'py, PyString>>
PyString::from_object
Deprecated name for PyString::from_object
.
Trait Implementations
Source§impl PyTypeInfo for PyString
impl PyTypeInfo for PyString
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
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
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>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
Source§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
.Source§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.Source§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.Source§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
.