pub struct JsHeaders { /* private fields */ }Expand description
A JavaScript wrapper for the Headers object.
Implementations§
Source§impl JsHeaders
impl JsHeaders
Sourcepub fn append(
&mut self,
key: Convert<String>,
value: Convert<String>,
) -> Result<(), JsError>
pub fn append( &mut self, key: Convert<String>, value: Convert<String>, ) -> Result<(), JsError>
Appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.
§Errors
If the key or value is not valid ASCII, an error is returned.
Sourcepub fn delete(&mut self, key: Convert<String>) -> Result<(), JsError>
pub fn delete(&mut self, key: Convert<String>) -> Result<(), JsError>
Deletes a header from a Headers object.
§Errors
If the key is not valid ASCII, an error is returned.
Sourcepub fn entries(&self, context: &mut Context) -> JsValue
pub fn entries(&self, context: &mut Context) -> JsValue
Returns an iterator allowing to go through all key/value pairs contained in this object.
Sourcepub fn for_each(
this: JsClass<JsHeaders>,
callback: TypedJsFunction<(JsString, JsString, JsObject), ()>,
this_arg: Option<JsValue>,
context: &mut Context,
) -> Result<(), JsError>
pub fn for_each( this: JsClass<JsHeaders>, callback: TypedJsFunction<(JsString, JsString, JsObject), ()>, this_arg: Option<JsValue>, context: &mut Context, ) -> Result<(), JsError>
Executes a provided function once for each key/value pair in the Headers object.
§Errors
If the callback function returns an error, it is returned.
Sourcepub fn get(
&self,
key: JsValue,
context: &mut Context,
) -> Result<JsValue, JsError>
pub fn get( &self, key: JsValue, context: &mut Context, ) -> Result<JsValue, JsError>
Returns a byte string of all the values in a header within a Headers object with a given name. If the requested header doesn’t exist in the Headers object, it returns null.
§Errors
If the key is not valid ASCII, an error is returned.
Trait Implementations§
Source§impl Class for JsHeaders
impl Class for JsHeaders
Source§const LENGTH: usize = 2usize
const LENGTH: usize = 2usize
0.Source§fn data_constructor(
this: &JsValue,
args: &[JsValue],
context: &mut Context,
) -> Result<JsHeaders, JsError>
fn data_constructor( this: &JsValue, args: &[JsValue], context: &mut Context, ) -> Result<JsHeaders, JsError>
Source§fn init(builder: &mut ClassBuilder<'_>) -> Result<(), JsError>
fn init(builder: &mut ClassBuilder<'_>) -> Result<(), JsError>
Source§const ATTRIBUTES: Attribute = _
const ATTRIBUTES: Attribute = _
writable, enumerable, configurable.Source§fn object_constructor(
instance: &JsObject,
args: &[JsValue],
context: &mut Context,
) -> Result<(), JsError>
fn object_constructor( instance: &JsObject, args: &[JsValue], context: &mut Context, ) -> Result<(), JsError>
Source§impl Trace for JsHeaders
impl Trace for JsHeaders
Source§unsafe fn trace_non_roots(&self)
unsafe fn trace_non_roots(&self)
Source§fn run_finalizer(&self)
fn run_finalizer(&self)
Finalize::finalize on this object and all
contained subobjects.impl JsData for JsHeaders
Auto Trait Implementations§
impl Freeze for JsHeaders
impl !RefUnwindSafe for JsHeaders
impl !Send for JsHeaders
impl !Sync for JsHeaders
impl Unpin for JsHeaders
impl !UnwindSafe for JsHeaders
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> NativeObject for T
impl<T> NativeObject for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
NativeObject to a &dyn Any.Source§fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
NativeObject to a &mut dyn Any.Source§fn type_name_of_value(&self) -> &'static str
fn type_name_of_value(&self) -> &'static str
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.