pub struct Header { /* private fields */ }Available on crate feature
client only.Expand description
Layer for inserting a header to requests.
Implementations§
Source§impl Header
impl Header
Sourcepub fn new(key: HeaderName, val: HeaderValue) -> Self
pub fn new(key: HeaderName, val: HeaderValue) -> Self
Create a new Header layer for inserting a header to requests.
This function takes HeaderName and HeaderValue, users should create it by
themselves.
For using string types directly, see Header::try_new.
Sourcepub fn try_new<K, V>(key: K, val: V) -> Result<Self>
pub fn try_new<K, V>(key: K, val: V) -> Result<Self>
Create a new Header layer for inserting a header to requests.
This function takes any types that can be converted into HeaderName or HeaderValue.
If the values are invalid HeaderName or HeaderValue, an ClientError with
ErrorKind::Builder will be returned.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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