Module response

Module response 

Source
Expand description

Response types.

This module contains types related to Google Cloud service responses. Notably it contains the Response type itself. Typically you’ll import this type.

§Examples

Inspecting the result of a request

// A type representing a Google Cloud service resource, for example, a
// secret manager secret.
struct Resource {
  // ...
}

async fn make_google_service_rpc(project_id: &str) -> Result<Response<Resource>> {
  // ...
}

let response = make_google_service_rpc("my-project").await?;
if let Some(date) = response.headers().get("Date") {
    // do something with the date
}
let resource = response.body();
// do something with

Creating a response for mocks

// A type representing a Google Cloud service resource, for example, a
// secret manager secret.
struct Resource {
  // ...
}

fn make_mock_response(body: Resource) -> Result<Response<Resource>> {
    Ok(Response::from(body))
}

Structs§

Parts
Component parts of a response.
Response
Represents a Google Cloud service response.