[][src]Struct mutf8::mstr

pub struct mstr { /* fields omitted */ }

Implementations

impl mstr[src]

pub fn from_utf8(bytes: &[u8]) -> MResult<Cow<'_, mstr>>[src]

pub fn from_mutf8(bytes: &[u8]) -> &mstr[src]

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_mut_bytes(&mut self) -> &mut [u8][src]

Returns a mutable 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 into_m_string(self: Box<mstr>) -> MString[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 first_mut(&mut self) -> Option<&mut u8>[src]

Returns a mutable 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.

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

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

Returns None if the string is empty.

Trait Implementations

impl AsRef<mstr> for mstr[src]

impl AsRef<mstr> for MString[src]

impl Borrow<mstr> for MString[src]

impl Debug for mstr[src]

impl Display for mstr[src]

impl Eq for mstr[src]

impl Hash for mstr[src]

impl PartialEq<mstr> for mstr[src]

impl StructuralEq for mstr[src]

impl StructuralPartialEq for mstr[src]

impl ToOwned for mstr[src]

type Owned = MString

The resulting type after obtaining ownership.

Auto Trait Implementations

impl RefUnwindSafe for mstr

impl Send for mstr

impl Sync for mstr

impl Unpin for mstr

impl UnwindSafe for mstr

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> ToString for T where
    T: Display + ?Sized
[src]