Struct ByteString

struct ByteString(785)

A wrapper for Vec<u8> representing a human-readable string that's conventionally, but not always, UTF-8.

Unlike String, this type permits non-UTF-8 contents, making it suitable for user input, non-native filenames (as Path only supports native filenames), and other applications that need to round-trip whatever data the user provides.

A ByteString owns its contents and can grow and shrink, like a Vec or String. For a borrowed byte string, see ByteStr.

ByteString implements Deref to &Vec<u8>, so all methods available on &Vec<u8> are available on ByteString. Similarly, ByteString implements DerefMut to &mut Vec<u8>, so you can modify a ByteString using any method available on &mut Vec<u8>.

The Debug and Display implementations for ByteString are the same as those for ByteStr, showing invalid UTF-8 as hex escapes or the Unicode replacement character, respectively.

Implementations

impl AsMut for ByteString

fn as_mut(self: &mut Self) -> &mut [u8]

impl AsMut for ByteString

fn as_mut(self: &mut Self) -> &mut ByteStr

impl AsRef for ByteString

fn as_ref(self: &Self) -> &[u8]

impl AsRef for ByteString

fn as_ref(self: &Self) -> &ByteStr

impl Borrow for ByteString

fn borrow(self: &Self) -> &[u8]

impl Borrow for ByteString

fn borrow(self: &Self) -> &ByteStr

impl BorrowMut for ByteString

fn borrow_mut(self: &mut Self) -> &mut [u8]

impl BorrowMut for ByteString

fn borrow_mut(self: &mut Self) -> &mut ByteStr

impl Clone for ByteString

fn clone(self: &Self) -> ByteString

impl Debug for ByteString

fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result

impl Default for ByteString

fn default() -> Self

impl Deref for ByteString

fn deref(self: &Self) -> &<Self as >::Target

impl DerefMut for ByteString

fn deref_mut(self: &mut Self) -> &mut <Self as >::Target

impl DerefPure for ByteString

impl Display for ByteString

fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result

impl Eq for ByteString

impl Freeze for ByteString

impl FromIterator for ByteString

fn from_iter<T: IntoIterator<Item = char>>(iter: T) -> Self

impl FromIterator for ByteString

fn from_iter<T: IntoIterator<Item = ByteString>>(iter: T) -> Self

impl FromIterator for ByteString

fn from_iter<T: IntoIterator<Item = u8>>(iter: T) -> Self

impl FromStr for ByteString

fn from_str(s: &str) -> Result<Self, <Self as >::Err>

impl Hash for ByteString

fn hash<H: hash::Hasher>(self: &Self, state: &mut H)

impl Index for ByteString

fn index(self: &Self, r: RangeFrom<usize>) -> &ByteStr

impl Index for ByteString

fn index(self: &Self, r: Range<usize>) -> &ByteStr

impl Index for ByteString

fn index(self: &Self, r: RangeTo<usize>) -> &ByteStr

impl Index for ByteString

fn index(self: &Self, r: RangeInclusive<usize>) -> &ByteStr

impl Index for ByteString

fn index(self: &Self, idx: usize) -> &u8

impl Index for ByteString

fn index(self: &Self, _: RangeFull) -> &ByteStr

impl Index for ByteString

fn index(self: &Self, r: RangeToInclusive<usize>) -> &ByteStr

impl IndexMut for ByteString

fn index_mut(self: &mut Self, idx: usize) -> &mut u8

impl IndexMut for ByteString

fn index_mut(self: &mut Self, r: Range<usize>) -> &mut ByteStr

impl IndexMut for ByteString

fn index_mut(self: &mut Self, r: RangeInclusive<usize>) -> &mut ByteStr

impl IndexMut for ByteString

fn index_mut(self: &mut Self, r: RangeFrom<usize>) -> &mut ByteStr

impl IndexMut for ByteString

fn index_mut(self: &mut Self, r: RangeTo<usize>) -> &mut ByteStr

impl IndexMut for ByteString

fn index_mut(self: &mut Self, _: RangeFull) -> &mut ByteStr

impl IndexMut for ByteString

fn index_mut(self: &mut Self, r: RangeToInclusive<usize>) -> &mut ByteStr

impl Ord for ByteString

fn cmp(self: &Self, other: &ByteString) -> Ordering

impl PartialEq for ByteString

fn eq(self: &Self, other: &ByteString) -> bool

impl PartialOrd for ByteString

fn partial_cmp(self: &Self, other: &ByteString) -> Option<Ordering>

impl RefUnwindSafe for ByteString

impl Send for ByteString

impl Sync for ByteString

impl Unpin for ByteString

impl UnwindSafe for ByteString

impl<'a> From for ByteString

fn from(s: &'a ByteStr) -> Self

impl<'a> FromIterator for ByteString

fn from_iter<T: IntoIterator<Item = &'a [u8]>>(iter: T) -> Self

impl<'a> FromIterator for ByteString

fn from_iter<T: IntoIterator<Item = &'a ByteStr>>(iter: T) -> Self

impl<'a> FromIterator for ByteString

fn from_iter<T: IntoIterator<Item = &'a str>>(iter: T) -> Self

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &&[u8]) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &Cow<'_, [u8]>) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &Vec<u8>) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &Cow<'_, str>) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &&str) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &Cow<'_, ByteStr>) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &String) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &&ByteStr) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &[u8]) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &ByteStr) -> bool

impl<'a> PartialEq for ByteString

fn eq(self: &Self, other: &str) -> bool

impl<'a> PartialOrd for ByteString

fn partial_cmp(self: &Self, other: &ByteStr) -> Option<Ordering>

impl<'a> PartialOrd for ByteString

fn partial_cmp(self: &Self, other: &Cow<'_, [u8]>) -> Option<Ordering>

impl<'a> PartialOrd for ByteString

fn partial_cmp(self: &Self, other: &Cow<'_, str>) -> Option<Ordering>

impl<'a> PartialOrd for ByteString

fn partial_cmp(self: &Self, other: &Cow<'_, ByteStr>) -> Option<Ordering>

impl<'a> PartialOrd for ByteString

fn partial_cmp(self: &Self, other: &&ByteStr) -> Option<Ordering>

impl<N: usize> PartialEq for ByteString

fn eq(self: &Self, other: &[u8; N]) -> bool

impl<N: usize> PartialEq for ByteString

fn eq(self: &Self, other: &&[u8; N]) -> bool

impl<P, T> Receiver for ByteString

impl<T> Any for ByteString

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for ByteString

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for ByteString

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for ByteString

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for ByteString

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for ByteString

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> ToString for ByteString

fn to_string(self: &Self) -> String

impl<T, U> Into for ByteString

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for ByteString

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for ByteString

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>