[][src]Struct bytestring::ByteString

pub struct ByteString(_);

An immutable UTF-8 encoded string with Bytes as a storage.

Implementations

impl ByteString[src]

pub const fn new() -> Self[src]

Creates a new empty ByteString.

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

Get a reference to the underlying Bytes object.

pub fn into_bytes(self) -> Bytes[src]

Unwraps this ByteString into the underlying Bytes object.

pub const fn from_static(src: &'static str) -> ByteString[src]

Creates a new ByteString from a &'static str.

pub const unsafe fn from_bytes_unchecked(src: Bytes) -> ByteString[src]

Creates a new ByteString from a Bytes.

Safety

This function is unsafe because it does not check the bytes passed to it are valid UTF-8. If this constraint is violated, it may cause memory unsafety issues with future users of the ByteString, as we assume that ByteStrings are valid UTF-8. However, the most likely issue is that the data gets corrupted.

Trait Implementations

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

impl AsRef<str> for ByteString[src]

impl Borrow<str> for ByteString[src]

impl Clone for ByteString[src]

impl Debug for ByteString[src]

impl Default for ByteString[src]

impl Deref for ByteString[src]

type Target = str

The resulting type after dereferencing.

impl Display for ByteString[src]

impl Eq for ByteString[src]

impl From<&'_ str> for ByteString[src]

impl From<String> for ByteString[src]

impl Hash for ByteString[src]

impl Ord for ByteString[src]

impl<T: AsRef<str>> PartialEq<T> for ByteString[src]

impl PartialEq<str> for ByteString[src]

impl PartialOrd<ByteString> for ByteString[src]

impl StructuralEq for ByteString[src]

impl TryFrom<&'_ [u8; 0]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 1]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 10]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 11]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 12]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 13]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 14]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 15]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 16]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 17]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 18]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 19]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 2]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 20]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 21]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 22]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 23]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 24]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 25]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 26]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 27]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 28]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 29]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 3]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 30]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 31]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 32]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 4]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 5]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 6]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 7]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 8]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8; 9]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<&'_ [u8]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 0]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 1]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 10]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 11]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 12]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 13]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 14]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 15]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 16]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 17]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 18]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 19]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 2]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 20]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 21]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 22]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 23]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 24]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 25]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 26]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 27]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 28]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 29]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 3]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 30]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 31]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 32]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 4]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 5]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 6]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 7]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 8]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<[u8; 9]> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<Bytes> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<BytesMut> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

impl TryFrom<Vec<u8, Global>> for ByteString[src]

type Error = Utf8Error

The type returned in the event of a conversion error.

Auto Trait Implementations

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