[−][src]Struct raw_string::RawString
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]
&mut self,
range: R,
replace_with: T
)
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]
&mut self,
index: I
) -> &mut I::Output
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]
&mut self,
begin: usize,
end: usize
) -> &mut RawStr
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]
Notable traits for Utf8ChunksIter<'a>
impl<'a> Iterator for Utf8ChunksIter<'a> type Item = Utf8Chunk<'a>;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]
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]
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 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?
fn into_iter(self) -> Self::IntoIter[src]
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?
fn into_iter(self) -> Self::IntoIter[src]
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?
fn into_iter(self) -> Self::IntoIter[src]
impl Ord for RawString[src]
fn cmp(&self, other: &RawString) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[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]
fn partial_cmp(&self, other: &&[u8]) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ RawStr> for RawString[src]
fn partial_cmp(&self, other: &&RawStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ str> for RawString[src]
fn partial_cmp(&self, other: &&str) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<[u8]> for RawString[src]
fn partial_cmp(&self, other: &[u8]) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<RawStr> for RawString[src]
fn partial_cmp(&self, other: &RawStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<RawString> for RawString[src]
fn partial_cmp(&self, other: &RawString) -> Option<Ordering>[src]
fn lt(&self, other: &RawString) -> bool[src]
fn le(&self, other: &RawString) -> bool[src]
fn gt(&self, other: &RawString) -> bool[src]
fn ge(&self, other: &RawString) -> bool[src]
impl PartialOrd<RawString> for RawStr[src]
fn partial_cmp(&self, other: &RawString) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<RawString> for str[src]
fn partial_cmp(&self, other: &RawString) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<RawString> for [u8][src]
fn partial_cmp(&self, other: &RawString) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<RawString> for &'_ RawStr[src]
fn partial_cmp(&self, other: &RawString) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<RawString> for &'_ str[src]
fn partial_cmp(&self, other: &RawString) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<RawString> for &'_ [u8][src]
fn partial_cmp(&self, other: &RawString) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<str> for RawString[src]
fn partial_cmp(&self, other: &str) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl RawStringExt for RawString[src]
Conversions only available on unix.
fn into_osstring(self) -> OsString[src]
fn into_pathbuf(self) -> PathBuf[src]
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]
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<I> IntoIterator for I where
I: Iterator, [src]
I: Iterator,
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?
pub fn into_iter(self) -> I[src]
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>,