pub enum HeaderValue {
Static(&'static str),
Inline(ArrayString<MAX_INLINE_VALUE>),
Heap(String),
}Expand description
An HTTP response header value that avoids heap allocation for short strings.
| Variant | Storage | Allocation |
|---|---|---|
Static | pointer | none |
Inline | 64-byte array on stack | none |
Heap | String on heap | one |
Variants§
Static(&'static str)
A compile-time constant string — zero cost to store.
Inline(ArrayString<MAX_INLINE_VALUE>)
A short (≤ 64 byte) runtime string stored on the stack.
Heap(String)
A long runtime string that did not fit inline.
Implementations§
Trait Implementations§
Source§impl Clone for HeaderValue
impl Clone for HeaderValue
Source§fn clone(&self) -> HeaderValue
fn clone(&self) -> HeaderValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HeaderValue
impl RefUnwindSafe for HeaderValue
impl Send for HeaderValue
impl Sync for HeaderValue
impl Unpin for HeaderValue
impl UnsafeUnpin for HeaderValue
impl UnwindSafe for HeaderValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more