Struct aws_smithy_runtime_api::http::Headers
source · pub struct Headers { /* private fields */ }
Expand description
An immutable view of headers
Implementations§
source§impl Headers
impl Headers
sourcepub fn get(&self, key: impl AsRef<str>) -> Option<&str>
pub fn get(&self, key: impl AsRef<str>) -> Option<&str>
Returns the value for a given key
If multiple values are associated, the first value is returned See HeaderMap::get
sourcepub fn get_all(&self, key: impl AsRef<str>) -> impl Iterator<Item = &str>
pub fn get_all(&self, key: impl AsRef<str>) -> impl Iterator<Item = &str>
Returns all values for a given key
sourcepub fn iter(&self) -> HeadersIter<'_> ⓘ
pub fn iter(&self) -> HeadersIter<'_> ⓘ
Returns an iterator over the headers
sourcepub fn contains_key(&self, key: impl AsRef<str>) -> bool
pub fn contains_key(&self, key: impl AsRef<str>) -> bool
Returns true if this header is present
sourcepub fn insert(
&mut self,
key: impl AsHeaderComponent,
value: impl AsHeaderComponent,
) -> Option<String>
pub fn insert( &mut self, key: impl AsHeaderComponent, value: impl AsHeaderComponent, ) -> Option<String>
Insert a value into the headers structure.
This will replace any existing value for this key. Returns the previous associated value if any.
§Panics
If the key is not valid ASCII, or if the value is not valid UTF-8, this function will panic.
sourcepub fn try_insert(
&mut self,
key: impl AsHeaderComponent,
value: impl AsHeaderComponent,
) -> Result<Option<String>, HttpError>
pub fn try_insert( &mut self, key: impl AsHeaderComponent, value: impl AsHeaderComponent, ) -> Result<Option<String>, HttpError>
Insert a value into the headers structure.
This will replace any existing value for this key. Returns the previous associated value if any.
If the key is not valid ASCII, or if the value is not valid UTF-8, this function will return an error.
sourcepub fn append(
&mut self,
key: impl AsHeaderComponent,
value: impl AsHeaderComponent,
) -> bool
pub fn append( &mut self, key: impl AsHeaderComponent, value: impl AsHeaderComponent, ) -> bool
Appends a value to a given key
§Panics
If the key is not valid ASCII, or if the value is not valid UTF-8, this function will panic.
sourcepub fn try_append(
&mut self,
key: impl AsHeaderComponent,
value: impl AsHeaderComponent,
) -> Result<bool, HttpError>
pub fn try_append( &mut self, key: impl AsHeaderComponent, value: impl AsHeaderComponent, ) -> Result<bool, HttpError>
Appends a value to a given key
If the key is not valid ASCII, or if the value is not valid UTF-8, this function will return an error.
Trait Implementations§
source§impl<'a> IntoIterator for &'a Headers
impl<'a> IntoIterator for &'a 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
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
)