Skip to main content

ResponseHeaders

Struct ResponseHeaders 

Source
pub struct ResponseHeaders<'storage> { /* private fields */ }
Expand description

Caller-storage-backed fixed-capacity response-header metadata.

Ordinary equality is intentionally unavailable because retained values may be sensitive.

use cloud_sdk::transport::ResponseHeaders;

let mut storage = [0_u8; 4096];
let headers = ResponseHeaders::new(&mut storage);
let _ = headers == headers;

Implementations§

Source§

impl<'storage> ResponseHeaders<'storage>

Source

pub fn new(storage: &'storage mut [u8]) -> Self

Creates an empty response-header collection.

Source

pub fn try_push( &mut self, name: &str, value: &[u8], sensitivity: HeaderSensitivity, ) -> Result<(), HeaderError>

Appends one header atomically after validating every bound.

Source

pub const fn len(&self) -> usize

Returns the retained header count.

Source

pub const fn is_empty(&self) -> bool

Reports whether no headers are retained.

Source

pub const fn encoded_len(&self) -> usize

Returns the aggregate encoded field-line length.

Source

pub fn iter(&self) -> impl Iterator<Item = ResponseHeader<'_>>

Iterates in retained order.

Source

pub fn get(&self, name: &str) -> Option<ResponseHeader<'_>>

Finds a retained header by ASCII case-insensitive name.

Source

pub fn retain_copy_into<'destination>( &self, destination: &'destination mut [u8], ) -> Result<ResponseHeaders<'destination>, HeaderError>

Creates a deliberate second cleanup-owning copy in caller storage.

Both the source and returned collection independently clear their complete caller-owned storage on drop.

Trait Implementations§

Source§

impl Debug for ResponseHeaders<'_>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for ResponseHeaders<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'storage> !UnwindSafe for ResponseHeaders<'storage>

§

impl<'storage> Freeze for ResponseHeaders<'storage>

§

impl<'storage> RefUnwindSafe for ResponseHeaders<'storage>

§

impl<'storage> Send for ResponseHeaders<'storage>

§

impl<'storage> Sync for ResponseHeaders<'storage>

§

impl<'storage> Unpin for ResponseHeaders<'storage>

§

impl<'storage> UnsafeUnpin for ResponseHeaders<'storage>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.