[][src]Struct mutf8::MString

pub struct MString { /* fields omitted */ }

Implementations

impl MString[src]

pub fn from_utf8(input: &[u8]) -> MResult<MString>[src]

pub fn from_mutf8(input: impl Into<Box<[u8]>>) -> MString[src]

pub fn into_string(self) -> MResult<String>[src]

pub fn into_mutf8_bytes(self) -> Vec<u8>[src]

pub fn into_boxed_mutf8_bytes(self) -> Box<[u8]>[src]

pub fn into_utf8_bytes(self) -> MResult<Vec<u8>>[src]

pub fn into_boxed_utf8_bytes(self) -> MResult<Box<[u8]>>[src]

pub fn as_mstr(&self) -> &mstr[src]

pub fn into_boxed_str(self) -> MResult<Box<str>>[src]

pub fn into_boxed_mstr(self) -> Box<mstr>[src]

pub fn as_mutf8_bytes(&self) -> &[u8][src]

pub fn as_utf8_bytes(&self) -> MResult<Cow<'_, [u8]>>[src]

Methods from Deref<Target = mstr>

pub fn len(&self) -> usize[src]

Returns the length of the string, in bytes.

pub fn is_empty(&self) -> bool[src]

Returns whether the string is empty.

pub fn as_bytes(&self) -> &[u8][src]

Returns a borrowed reference to the internal byte slice.

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

Returns a raw pointer to the contained buffer.

pub fn to_str(&self) -> MResult<Cow<'_, str>>[src]

pub fn to_utf8(&self) -> MResult<Cow<'_, str>>[src]

pub fn get(&self, idx: usize) -> Option<&u8>[src]

Returns the byte at the given index.

Returns None if idx is greater than or equal to the string length.

pub unsafe fn get_unchecked(&self, idx: usize) -> &u8[src]

Returns the byte at the given index, bypassing bounds-checking.

Safety

The caller of this function must guarantee that idx is less than the string length.

pub fn first(&self) -> Option<&u8>[src]

Returns a borrowed reference to the first byte in the string.

Returns None if the string is empty.

pub fn last(&self) -> Option<&u8>[src]

Returns a borrowed reference to the last byte in the string.

Returns None if the string is empty.

Trait Implementations

impl AsRef<mstr> for MString[src]

impl Borrow<mstr> for MString[src]

impl Clone for MString[src]

impl Debug for MString[src]

impl Deref for MString[src]

type Target = mstr

The resulting type after dereferencing.

impl Display for MString[src]

impl Eq for MString[src]

impl From<Box<mstr, Global>> for MString[src]

impl<'a> From<Cow<'a, mstr>> for MString[src]

impl From<MString> for Box<mstr>[src]

impl<'a> From<MString> for Cow<'a, mstr>[src]

impl Hash for MString[src]

impl PartialEq<MString> for MString[src]

impl StructuralEq for MString[src]

impl StructuralPartialEq for MString[src]

impl TryFrom<MString> for Vec<u8>[src]

type Error = MError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for MString

impl Send for MString

impl Sync for MString

impl Unpin for MString

impl UnwindSafe for MString

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.