pub struct Headers {
pub headers: Vec<(String, String)>,
}Fields§
§headers: Vec<(String, String)>Name-value pairs.
Implementations§
Source§impl Headers
impl Headers
Sourcepub fn new(headers: &[(&str, &str)]) -> Self
pub fn new(headers: &[(&str, &str)]) -> Self
use ehttp::Request;
let request = Request {
headers: ehttp::Headers::new(&[
("Accept", "*/*"),
("Content-Type", "text/plain; charset=utf-8"),
]),
..Request::get("https://www.example.com")
};Sourcepub fn insert(&mut self, key: impl ToString, value: impl ToString)
pub fn insert(&mut self, key: impl ToString, value: impl ToString)
Will add the key/value pair to the headers.
If the key already exists, it will also be kept, so the same key can appear twice.
Sourcepub fn get(&self, key: &str) -> Option<&str>
pub fn get(&self, key: &str) -> Option<&str>
Get the value of the first header with the given key.
The lookup is case-insensitive.
Trait Implementations§
Source§impl<'h> IntoIterator for &'h Headers
impl<'h> IntoIterator for &'h Headers
Source§impl IntoIterator for Headers
impl IntoIterator for Headers
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