Enum cpython::PyStringData [] [src]

pub enum PyStringData<'a> {
    Latin1(&'a [u8]),
    Utf8(&'a [u8]),
    Utf16(&'a [u16]),
    Utf32(&'a [u32]),
}

Enum of possible Python string representations.

Variants

Methods

impl<'a> PyStringData<'a>
[src]

Convert the Python string data to a Rust string.

For UTF-8 and ASCII-only latin-1, returns a borrow into the original string data. For Latin-1, UTF-16 and UTF-32, returns an owned string.

Fails with UnicodeDecodeError if the string data isn't valid in its encoding.

Convert the Python string data to a Rust string.

Returns a borrow into the original string data if possible.

Data that isn't valid in its encoding will be replaced with U+FFFD REPLACEMENT CHARACTER.

Trait Implementations

impl<'a> Clone for PyStringData<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Copy for PyStringData<'a>
[src]

impl<'a> Debug for PyStringData<'a>
[src]

Formats the value using the given formatter.

impl<'a> From<&'a str> for PyStringData<'a>
[src]

Performs the conversion.

impl<'a> From<&'a [u16]> for PyStringData<'a>
[src]

Performs the conversion.

impl<'a> From<&'a [u32]> for PyStringData<'a>
[src]

Performs the conversion.