[][src]Struct raw_string::RawString

pub struct RawString { /* fields omitted */ }

A String with unchecked contents.

It is basically a Vec<u8>, to be interpreted as string. Unlike String, there are no guarantees about the contents being valid UTF-8. Unlike Vec<u8>, its Display and Debug implementations show a string, not an array of numbers.

Implementations

impl RawString[src]

pub fn new() -> Self[src]

pub fn with_capacity(capacity: usize) -> Self[src]

pub fn from_bytes(bytes: Vec<u8>) -> Self[src]

pub fn from_string(bytes: String) -> Self[src]

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

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

pub fn reserve(&mut self, additional: usize)[src]

pub fn reserve_exact(&mut self, additional: usize)[src]

pub fn shrink_to_fit(&mut self)[src]

pub fn clear(&mut self)[src]

pub fn truncate(&mut self, new_len: usize)[src]

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

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

pub fn retain<F: FnMut(u8) -> bool>(&mut self, f: F)[src]

pub fn insert(&mut self, idx: usize, b: u8)[src]

pub fn insert_str<T: AsRef<RawStr>>(&mut self, idx: usize, s: T)[src]

pub fn split_off(&mut self, at: usize) -> RawString[src]

pub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> Drain<'_, u8>[src]

pub fn replace_range<R: RangeBounds<usize>, T: AsRef<RawStr>>(
    &mut self,
    range: R,
    replace_with: T
)
[src]

pub fn into_boxed_raw_str(self) -> Box<RawStr>[src]

pub fn push(&mut self, b: u8)[src]

pub fn push_str<T: AsRef<RawStr>>(&mut self, s: T)[src]

pub fn as_mut_bytes(&mut self) -> &mut Vec<u8>[src]

pub fn to_string(self) -> Result<String, FromUtf8Error>[src]

pub fn to_osstring(self) -> Result<OsString, FromUtf8Error>[src]

Convert to an OsString.

On Unix, it never fails. On other platforms, it must be encoded as UTF-8.

A never-failing version for Unix only is available as unix::RawStringExt::into_osstring.

pub fn to_pathbuf(self) -> Result<PathBuf, FromUtf8Error>[src]

Convert to a PathBuf.

On Unix, it never fails. On other platforms, it must be encoded as UTF-8.

A never-failing version for Unix only is available as unix::RawStringExt::into_pathbuf.

Methods from Deref<Target = RawStr>

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

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

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

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

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

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

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

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

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

pub fn split_first(&self) -> Option<(u8, &RawStr)>[src]

pub fn split_first_mut(&mut self) -> Option<(&mut u8, &mut RawStr)>[src]

pub fn split_last(&self) -> Option<(u8, &RawStr)>[src]

pub fn split_last_mut(&mut self) -> Option<(&mut u8, &mut RawStr)>[src]

pub fn split_at(&self, mid: usize) -> (&RawStr, &RawStr)[src]

pub fn split_at_mut(&mut self, mid: usize) -> (&mut RawStr, &mut RawStr)[src]

pub fn contains_byte(&self, x: u8) -> bool[src]

pub fn starts_with<T: AsRef<RawStr>>(&self, x: T) -> bool[src]

pub fn ends_with<T: AsRef<RawStr>>(&self, x: T) -> bool[src]

pub fn get<I: RawStrIndex>(&self, index: I) -> Option<&I::Output>[src]

pub fn get_mut<I: RawStrIndex>(&mut self, index: I) -> Option<&mut I::Output>[src]

pub unsafe fn get_unchecked<I: RawStrIndex>(&self, index: I) -> &I::Output[src]

pub unsafe fn get_unchecked_mut<I: RawStrIndex>(
    &mut self,
    index: I
) -> &mut I::Output
[src]

pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &RawStr[src]

pub unsafe fn slice_mut_unchecked(
    &mut self,
    begin: usize,
    end: usize
) -> &mut RawStr
[src]

pub fn bytes(&self) -> Cloned<Iter<'_, u8>>[src]

pub fn bytes_mut(&mut self) -> IterMut<'_, u8>[src]

pub fn utf8_chunks(&self) -> Utf8ChunksIter<'_>

Notable traits for Utf8ChunksIter<'a>

impl<'a> Iterator for Utf8ChunksIter<'a> type Item = Utf8Chunk<'a>;
[src]

Iterate over chunks of valid UTF-8.

The iterator iterates over the chunks of valid UTF-8 separated by any broken characters, which could be replaced by the unicode replacement character.

pub fn to_str(&self) -> Result<&str, Utf8Error>[src]

pub fn to_osstr(&self) -> Result<&OsStr, Utf8Error>[src]

Convert to an OsStr.

On Unix, it never fails. On other platforms, it must be encoded as UTF-8.

A never-failing version for Unix only is available as unix::RawStrExt::as_osstr.

pub fn to_path(&self) -> Result<&Path, Utf8Error>[src]

Convert to a Path.

On Unix, it never fails. On other platforms, it must be encoded as UTF-8.

A never-failing version for Unix only is available as unix::RawStrExt::as_path.

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

pub fn eq_ignore_ascii_case(&self, other: &RawStr) -> bool[src]

pub fn make_ascii_uppercase(&mut self)[src]

pub fn make_ascii_lowercase(&mut self)[src]

Trait Implementations

impl AsRef<[u8]> for RawString[src]

impl AsRef<RawStr> for RawString[src]

impl Borrow<RawStr> for RawString[src]

impl Clone for RawString[src]

impl Debug for RawString[src]

impl Default for RawString[src]

impl Deref for RawString[src]

type Target = RawStr

The resulting type after dereferencing.

impl DerefMut for RawString[src]

impl Display for RawString[src]

impl Eq for RawString[src]

impl<'a> From<&'a [u8]> for RawString[src]

impl<'a> From<&'a RawStr> for RawString[src]

impl<'a> From<&'a str> for RawString[src]

impl From<String> for RawString[src]

impl From<Vec<u8>> for RawString[src]

impl Hash for RawString[src]

impl IntoIterator for RawString[src]

type Item = u8

The type of the elements being iterated over.

type IntoIter = IntoIter<u8>

Which kind of iterator are we turning this into?

impl<'a> IntoIterator for &'a RawString[src]

type Item = u8

The type of the elements being iterated over.

type IntoIter = Cloned<Iter<'a, u8>>

Which kind of iterator are we turning this into?

impl<'a> IntoIterator for &'a mut RawString[src]

type Item = &'a mut u8

The type of the elements being iterated over.

type IntoIter = IterMut<'a, u8>

Which kind of iterator are we turning this into?

impl Ord for RawString[src]

impl<'_> PartialEq<&'_ [u8]> for RawString[src]

impl<'_> PartialEq<&'_ RawStr> for RawString[src]

impl<'_> PartialEq<&'_ str> for RawString[src]

impl PartialEq<[u8]> for RawString[src]

impl PartialEq<RawStr> for RawString[src]

impl PartialEq<RawString> for RawString[src]

impl PartialEq<RawString> for RawStr[src]

impl PartialEq<RawString> for str[src]

impl PartialEq<RawString> for [u8][src]

impl<'_> PartialEq<RawString> for &'_ RawStr[src]

impl<'_> PartialEq<RawString> for &'_ str[src]

impl<'_> PartialEq<RawString> for &'_ [u8][src]

impl PartialEq<str> for RawString[src]

impl<'_> PartialOrd<&'_ [u8]> for RawString[src]

impl<'_> PartialOrd<&'_ RawStr> for RawString[src]

impl<'_> PartialOrd<&'_ str> for RawString[src]

impl PartialOrd<[u8]> for RawString[src]

impl PartialOrd<RawStr> for RawString[src]

impl PartialOrd<RawString> for RawString[src]

impl PartialOrd<RawString> for RawStr[src]

impl PartialOrd<RawString> for str[src]

impl PartialOrd<RawString> for [u8][src]

impl<'_> PartialOrd<RawString> for &'_ RawStr[src]

impl<'_> PartialOrd<RawString> for &'_ str[src]

impl<'_> PartialOrd<RawString> for &'_ [u8][src]

impl PartialOrd<str> for RawString[src]

impl RawStringExt for RawString[src]

Conversions only available on unix.

impl StructuralEq for RawString[src]

impl StructuralPartialEq for RawString[src]

Auto Trait Implementations

impl RefUnwindSafe for RawString

impl Send for RawString

impl Sync for RawString

impl Unpin for RawString

impl UnwindSafe for RawString

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.