[−][src]Struct mutf8::mstr
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,