pub struct Headers { /* private fields */ }
builder
only.Expand description
A set of email headers
Implementations
sourceimpl 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 RefUnwindSafe for Headers
impl Send for Headers
impl Sync for Headers
impl Unpin for Headers
impl UnwindSafe for Headers
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more