[−][src]Struct mutf8::MString
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]
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]
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,
impl PartialEq<MString> for MString
[src]
impl StructuralEq for MString
[src]
impl StructuralPartialEq for MString
[src]
impl TryFrom<MString> for Vec<u8>
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,