pub struct Headers(pub Headers);
Expand description
A Headers representation used in Request and Response objects.
Tuple Fields§
§0: Headers
Implementations§
source§impl Headers
impl Headers
sourcepub fn get(&self, name: &str) -> Result<Option<String>>
pub fn get(&self, name: &str) -> Result<Option<String>>
Returns all the values of a header within a Headers
object with a given name.
Returns an error if the name is invalid (e.g. contains spaces)
sourcepub fn has(&self, name: &str) -> Result<bool>
pub fn has(&self, name: &str) -> Result<bool>
Returns a boolean stating whether a Headers
object contains a certain header.
Returns an error if the name is invalid (e.g. contains spaces)
sourcepub fn append(&mut self, name: &str, value: &str) -> Result<()>
pub fn append(&mut self, name: &str, value: &str) -> Result<()>
Returns an error if the name is invalid (e.g. contains spaces)
sourcepub fn set(&mut self, name: &str, value: &str) -> Result<()>
pub fn set(&mut self, name: &str, value: &str) -> Result<()>
Sets a new value for an existing header inside a Headers
object, or adds the header if it does not already exist.
Returns an error if the name is invalid (e.g. contains spaces)
sourcepub fn delete(&mut self, name: &str) -> Result<()>
pub fn delete(&mut self, name: &str) -> Result<()>
Deletes a header from a Headers
object.
Returns an error if the name is invalid (e.g. contains spaces)
or if the JS Headers object’s guard is immutable (e.g. for an incoming request)
sourcepub fn entries(
&self,
) -> Map<Map<IntoIter, fn(_: Result<JsValue, JsValue>) -> Array>, fn(_: Array) -> (String, String)> ⓘ
pub fn entries( &self, ) -> Map<Map<IntoIter, fn(_: Result<JsValue, JsValue>) -> Array>, fn(_: Array) -> (String, String)> ⓘ
Returns an iterator allowing to go through all key/value pairs contained in this object.
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)