[][src]Struct memur::UStr

pub struct UStr { /* fields omitted */ }

UTF-8 string that does not contain nul values, and is stored with nul termination for easy conversion to CStr.

This string is valid even when Arena is dropped, because it holds a weak arena reference which does not return memory back to Memory as long as it is alive. That said, make sure to drop all these strings to reclaim the memory.

Implementations

impl UStr[src]

pub fn from_cstr(arena: &Arena, value: &CStr) -> Result<UStr, UStrError>[src]

Initialize from &CStr.

pub fn from_trusted_cstr_ptr(
    arena: &Arena,
    bytes: *const i8
) -> Result<UStr, UStrError>
[src]

Initialize from char* which comes from a trusted source.

pub fn from_str(arena: &Arena, value: &str) -> Result<UStr, UStrError>[src]

Initialize from &str.

pub fn as_ptr(&self) -> *const i8[src]

Get pointer to char*.

Trait Implementations

impl AsRef<CStr> for UStr[src]

impl AsRef<str> for UStr[src]

impl Clone for UStr[src]

impl Debug for UStr[src]

impl Display for UStr[src]

impl Eq for UStr[src]

impl PartialEq<UStr> for UStr[src]

impl PartialEq<UStr> for str[src]

impl PartialEq<UStr> for String[src]

impl PartialEq<UStr> for CStr[src]

impl PartialEq<UStr> for CString[src]

impl PartialEq<str> for UStr[src]

Auto Trait Implementations

impl RefUnwindSafe for UStr

impl !Send for UStr

impl !Sync for UStr

impl Unpin for UStr

impl UnwindSafe for UStr

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.