Skip to main content

Value

Struct Value 

Source
pub struct Value<T>(/* private fields */);
Expand description

An owned or borrowed HTTP field value validated before storage.

Implementations§

Source§

impl<T: Bytes> Value<T>

Source

pub fn new(value: T) -> Result<Self, Error>

Source

pub fn as_bytes(&self) -> &[u8] ⓘ

Source

pub fn borrow(&self) -> Value<&[u8]>

Source§

impl<T> Value<T>

Source

pub fn into_inner(self) -> T

Source§

impl<'a> Value<&'a [u8]>

Source

pub const fn try_bytes(value: &'a [u8]) -> Result<Self, Error>

Source

pub const fn get(self) -> &'a [u8] ⓘ

Source§

impl<'field> Value<Cow<'field, [u8]>>

Source

pub fn try_copy(value: &[u8]) -> Result<Self, Error>

Source§

impl Value<Cow<'_, str>>

Source§

impl<T: Text> Value<T>

Source

pub fn as_str(&self) -> &str

Trait Implementations§

Source§

impl<T: Bytes> Admit<T> for Value<T>

Source§

unsafe fn from_raw(owner: T) -> Self

§Safety

These exact immutable bytes must satisfy Error::is_text; binary or layout admission is insufficient.

Source§

impl<T: Bytes> AsValue for Value<T>

Source§

fn as_value(&self) -> Value<&[u8]>

Source§

impl<T: Copy> Clone for Value<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Copy> Copy for Value<T>

Source§

impl<T: Debug> Debug for Value<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Bytes> Encode for Value<T>

Source§

fn encoded_len(&self) -> usize

Source§

fn try_write<E>(self, emit: impl FnMut(&[u8]) -> Result<(), E>) -> Result<(), E>

Stops at the first rejected fragment and preserves its exact error.
Source§

fn encode(self, out: &mut impl Writer)
where Self: Sized,

Source§

impl<T: Eq> Eq for Value<T>

Source§

impl<T: PartialEq> PartialEq for Value<T>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq> StructuralPartialEq for Value<T>

Auto Trait Implementations§

§

impl<T> Forget for Value<T>

§

impl<T> Freeze for Value<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Value<T>
where T: RefUnwindSafe,

§

impl<T> Send for Value<T>
where T: Send,

§

impl<T> Sync for Value<T>
where T: Sync,

§

impl<T> Unpin for Value<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Value<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Value<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Convert<T> for T

Source§

fn into(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.