pub struct Field { /* private fields */ }Expand description
One pair with a token name, retaining the original name spelling and value bytes.
Implementations§
Source§impl Field
impl Field
pub fn new( name: impl AsRef<str>, value: impl AsRef<[u8]>, ) -> Result<Self, FieldError>
pub fn name(&self) -> &str
pub fn value(&self) -> &[u8] ⓘ
Sourcepub fn has_dangerous_bytes(&self) -> bool
pub fn has_dangerous_bytes(&self) -> bool
Whether the value contains CR, LF or NUL, which RFC 9110 (section 5.5) calls invalid and dangerous in field values. HTTP/1 cannot carry them, and HTTP/2 and HTTP/3 forbid them without a negotiated extension. This is recorded when the field is constructed.
Trait Implementations§
impl Eq for Field
Source§impl Extend<Field> for Fields
impl Extend<Field> for Fields
Source§fn extend<T: IntoIterator<Item = Field>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Field>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<Field> for Fields
impl FromIterator<Field> for Fields
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnsafeUnpin for Field
impl UnwindSafe for Field
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