Struct Utf8Bytes

struct Utf8Bytes(_)

UTF-8 wrapper for [Bytes].

An [Utf8Bytes] is always guaranteed to contain valid UTF-8.

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.

impl Clone for Utf8Bytes

fn clone(self: &Self) -> Utf8Bytes

impl Debug for Utf8Bytes

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::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 = axum::extract::ws::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 std::fmt::Formatter<'_>) -> std::fmt::Result

impl Eq for Utf8Bytes

impl Freeze for Utf8Bytes

impl From for Utf8Bytes

fn from(s: &str) -> Self

impl From for Utf8Bytes

fn from(s: &String) -> Self

impl From for Utf8Bytes

fn from(s: String) -> Self

impl PartialEq for Utf8Bytes

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

impl RefUnwindSafe for Utf8Bytes

impl Send for Utf8Bytes

impl StructuralPartialEq for Utf8Bytes

impl Sync for Utf8Bytes

impl TryFrom for Utf8Bytes

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

impl TryFrom for Utf8Bytes

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

impl Unpin for Utf8Bytes

impl UnwindSafe for Utf8Bytes

impl<P, T> Receiver for Utf8Bytes

impl<Q, K> Equivalent for Utf8Bytes

fn equivalent(self: &Self, key: &K) -> bool

impl<Q, K> Equivalent for Utf8Bytes

fn equivalent(self: &Self, key: &K) -> bool

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> FromRef for Utf8Bytes

fn from_ref(input: &T) -> T

impl<T> Instrument for Utf8Bytes

impl<T> PartialEq for Utf8Bytes

fn eq(self: &Self, other: &T) -> bool
let payload = axum::extract::ws::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> WithSubscriber for Utf8Bytes

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