Enum pyo3::types::PyStringData [−][src]
Expand description
Represents raw data backing a Python str
.
Python internally stores strings in various representations. This enumeration represents those variations.
Variants
UCS1 representation.
UCS2 representation.
UCS4 representation.
Implementations
Size in bytes of each value/item in the underlying slice.
Convert the raw data to a Rust string.
For UCS-1 / UTF-8, returns a borrow into the original slice. For UCS-2 and UCS-4, returns an owned string.
Returns PyUnicodeDecodeError if the string data isn’t valid in its purported
storage format. This should only occur for strings that were created via Python
C APIs that skip input validation (like PyUnicode_FromKindAndData
) and should
never occur for strings that were created from Python code.
Convert the raw data to a Rust string, possibly with data loss.
Invalid code points will be replaced with U+FFFD REPLACEMENT CHARACTER
.
Returns a borrow into original data, when possible, or owned data otherwise.
The return value of this function should only disagree with Self::to_string when that method would error.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<'a> RefUnwindSafe for PyStringData<'a>
impl<'a> Send for PyStringData<'a>
impl<'a> Sync for PyStringData<'a>
impl<'a> Unpin for PyStringData<'a>
impl<'a> UnwindSafe for PyStringData<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more