Struct Utf8Bytes

struct Utf8Bytes(_)

Utf8 payload.

Implementations

impl Utf8Bytes

const fn from_static(str: &'static str) -> Self

Creates from a static str.

fn as_str(self: &Self) -> &str

Returns as a string slice.

unsafe fn from_bytes_unchecked(bytes: Bytes) -> Self

Creates from a Bytes object without checking the encoding.

Safety

The bytes passed in must be valid UTF-8.

impl AsRef for Utf8Bytes

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

impl AsRef for Utf8Bytes

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

impl AsRef for Utf8Bytes

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

impl Borrow for Utf8Bytes

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

impl Clone for Utf8Bytes

fn clone(self: &Self) -> Utf8Bytes

impl Debug for Utf8Bytes

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

impl Default for Utf8Bytes

fn default() -> Utf8Bytes

impl Deref for Utf8Bytes

fn deref(self: &Self) -> &<Self as >::Target
/// Example fn that takes a str slice
fn a(s: &str) {}

let data = tungstenite::Utf8Bytes::from_static("foo123");

// auto-deref as arg
a(&data);

// deref to str methods
assert_eq!(data.len(), 6);

impl Display for Utf8Bytes

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

impl Eq for Utf8Bytes

impl Freeze for Utf8Bytes

impl From for Utf8Bytes

fn from(s: &String) -> Self

impl From for Utf8Bytes

fn from(s: &str) -> Self

impl From for Utf8Bytes

fn from(s: String) -> Self

impl Hash for Utf8Bytes

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl Ord for Utf8Bytes

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

impl PartialEq for Utf8Bytes

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

impl PartialOrd for Utf8Bytes

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

impl RefUnwindSafe for Utf8Bytes

impl Send for Utf8Bytes

impl StructuralPartialEq for Utf8Bytes

impl Sync for Utf8Bytes

impl TryFrom for Utf8Bytes

fn try_from(bytes: BytesMut) -> Result<Self, <Self as >::Error>

impl TryFrom for Utf8Bytes

fn try_from(v: Vec<u8>) -> Result<Self, <Self as >::Error>

impl TryFrom for Utf8Bytes

fn try_from(bytes: Bytes) -> Result<Self, <Self as >::Error>

impl Unpin for Utf8Bytes

impl UnsafeUnpin for Utf8Bytes

impl UnwindSafe for Utf8Bytes

impl<P, T> Receiver for Utf8Bytes

impl<T> Any for Utf8Bytes

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Utf8Bytes

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

impl<T> BorrowMut for Utf8Bytes

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

impl<T> CloneToUninit for Utf8Bytes

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

impl<T> From for Utf8Bytes

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> PartialEq for Utf8Bytes

fn eq(self: &Self, other: &T) -> bool
let payload = tungstenite::Utf8Bytes::from_static("foo123");
assert_eq!(payload, "foo123");
assert_eq!(payload, "foo123".to_string());
assert_eq!(payload, &"foo123".to_string());
assert_eq!(payload, std::borrow::Cow::from("foo123"));

impl<T> Same for Utf8Bytes

impl<T> ToOwned for Utf8Bytes

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

impl<T> ToString for Utf8Bytes

fn to_string(self: &Self) -> String

impl<T, U> Into for Utf8Bytes

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 Utf8Bytes

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

impl<T, U> TryInto for Utf8Bytes

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

impl<V, T> VZip for Utf8Bytes

fn vzip(self: Self) -> V