[][src]Struct raw_string::RawStr

pub struct RawStr { /* fields omitted */ }

A str with unchecked contents.

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

Implementations

impl RawStr[src]

pub fn from<S: AsRef<RawStr> + ?Sized>(s: &S) -> &Self[src]

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

pub fn from_str(bytes: &str) -> &Self[src]

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

pub fn from_bytes_mut(bytes: &mut [u8]) -> &mut Self[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 RawStr[src]

impl AsRef<RawStr> for RawStr[src]

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

impl AsRef<RawStr> for str[src]

impl AsRef<RawStr> for RawString[src]

impl Borrow<RawStr> for RawString[src]

impl Debug for RawStr[src]

impl<'a> Default for &'a RawStr[src]

impl<'a> Default for &'a mut RawStr[src]

impl Display for RawStr[src]

impl Eq for RawStr[src]

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

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

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

impl Hash for RawStr[src]

impl<I: RawStrIndex> Index<I> for RawStr[src]

type Output = I::Output

The returned type after indexing.

impl<I: RawStrIndex> IndexMut<I> for RawStr[src]

impl<'a> IntoIterator for &'a RawStr[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 RawStr[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 RawStr[src]

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

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

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

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

impl PartialEq<RawStr> for RawStr[src]

impl PartialEq<RawStr> for str[src]

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

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

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

impl PartialEq<RawStr> for RawString[src]

impl PartialEq<RawString> for RawStr[src]

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

impl PartialEq<str> for RawStr[src]

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

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

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

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

impl PartialOrd<RawStr> for RawStr[src]

impl PartialOrd<RawStr> for str[src]

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

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

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

impl PartialOrd<RawStr> for RawString[src]

impl PartialOrd<RawString> for RawStr[src]

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

impl PartialOrd<str> for RawStr[src]

impl RawStrExt for RawStr[src]

Conversions only available on unix.

impl StructuralEq for RawStr[src]

impl StructuralPartialEq for RawStr[src]

impl ToOwned for RawStr[src]

type Owned = RawString

The resulting type after obtaining ownership.

Auto Trait Implementations

impl RefUnwindSafe for RawStr

impl Send for RawStr

impl Sync for RawStr

impl Unpin for RawStr

impl UnwindSafe for RawStr

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> 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]