pub struct CheckedResponseGuard<'buffer> { /* private fields */ }Expand description
Policy-checked response that owns cleanup of its caller storage.
Borrowed access is closure-scoped. Self::decode_owned clears the
complete response storage before returning the owned decoded result.
Implementations§
Source§impl CheckedResponseGuard<'_>
impl CheckedResponseGuard<'_>
Sourcepub const fn status(&self) -> StatusCode
pub const fn status(&self) -> StatusCode
Returns the checked status code.
Sourcepub fn content_type(&self) -> Option<ResponseContentType<'_>>
pub fn content_type(&self) -> Option<ResponseContentType<'_>>
Returns the checked response content type when supplied.
Sourcepub const fn rate_limit(&self) -> Option<RateLimit>
pub const fn rate_limit(&self) -> Option<RateLimit>
Returns validated rate-limit metadata when supplied.
Sourcepub fn with_borrowed<R>(
&self,
inspect: impl for<'response> FnOnce(CheckedResponse<'response>) -> R,
) -> R
pub fn with_borrowed<R>( &self, inspect: impl for<'response> FnOnce(CheckedResponse<'response>) -> R, ) -> R
Runs a closure with a checked response borrow that cannot escape.
ⓘ
use cloud_sdk::operation::CheckedResponseGuard;
fn escape<'guard>(
guard: &'guard CheckedResponseGuard<'_>,
) -> &'guard [u8] {
guard.with_borrowed(|response| response.body())
}Sourcepub fn decode_owned<R, E>(
self,
decode: impl for<'response> FnOnce(CheckedResponse<'response>) -> Result<R, E>,
) -> Result<R, E>
pub fn decode_owned<R, E>( self, decode: impl for<'response> FnOnce(CheckedResponse<'response>) -> Result<R, E>, ) -> Result<R, E>
Decodes an owned value, clears all response storage, and then returns.
Sourcepub fn decode_owned_with_workspace<R, E>(
self,
decode: impl for<'response> FnOnce(CheckedResponse<'response>, &mut ResponseDecodeWorkspace) -> Result<R, E>,
) -> Result<R, E>
pub fn decode_owned_with_workspace<R, E>( self, decode: impl for<'response> FnOnce(CheckedResponse<'response>, &mut ResponseDecodeWorkspace) -> Result<R, E>, ) -> Result<R, E>
Decodes with guard-owned scratch, then clears the complete workspace.
Sourcepub fn retain_metadata_into<'destination>(
&mut self,
destination: &'destination mut [u8],
request_id_limit: usize,
) -> Result<RetainedResponseMetadata<'destination>, RetainedMetadataError>
pub fn retain_metadata_into<'destination>( &mut self, destination: &'destination mut [u8], request_id_limit: usize, ) -> Result<RetainedResponseMetadata<'destination>, RetainedMetadataError>
Atomically moves a retainable request ID into another cleanup owner.
Trait Implementations§
Auto Trait Implementations§
impl<'buffer> !RefUnwindSafe for CheckedResponseGuard<'buffer>
impl<'buffer> !Send for CheckedResponseGuard<'buffer>
impl<'buffer> !Sync for CheckedResponseGuard<'buffer>
impl<'buffer> !UnwindSafe for CheckedResponseGuard<'buffer>
impl<'buffer> Freeze for CheckedResponseGuard<'buffer>
impl<'buffer> Unpin for CheckedResponseGuard<'buffer>
impl<'buffer> UnsafeUnpin for CheckedResponseGuard<'buffer>
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