pub struct Headers { /* private fields */ }
Expand description
A set of email headers
Implementations§
Source§impl Headers
impl Headers
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create an empty Headers
with a pre-allocated capacity
Pre-allocates a capacity of at least capacity
.
Sourcepub fn get<H: Header>(&self) -> Option<H>
pub fn get<H: Header>(&self) -> Option<H>
Returns a copy of an Header
present in Headers
Returns None
if Header
isn’t present in Headers
.
Sourcepub fn set<H: Header>(&mut self, header: H)
pub fn set<H: Header>(&mut self, header: H)
Sets Header
into Headers
, overriding Header
if it
was already present in Headers
Sourcepub fn remove<H: Header>(&mut self) -> Option<H>
pub fn remove<H: Header>(&mut self) -> Option<H>
Remove Header
from Headers
, returning it
Returns None
if Header
isn’t in Headers
.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears Headers
, removing all headers from it
Any pre-allocated capacity is left untouched.
Sourcepub fn get_raw(&self, name: &str) -> Option<&str>
pub fn get_raw(&self, name: &str) -> Option<&str>
Returns a reference to the raw value of header name
Returns None
if name
isn’t present in Headers
.
Sourcepub fn insert_raw(&mut self, value: HeaderValue)
pub fn insert_raw(&mut self, value: HeaderValue)
Inserts a raw header into Headers
, overriding value
if it
was already present in Headers
.
Sourcepub fn remove_raw(&mut self, name: &str) -> Option<HeaderValue>
pub fn remove_raw(&mut self, name: &str) -> Option<HeaderValue>
Remove a raw header from Headers
, returning it
Returns None
if name
isn’t present in Headers
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Headers
impl RefUnwindSafe for Headers
impl Send for Headers
impl Sync for Headers
impl Unpin for Headers
impl UnwindSafe for Headers
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