Struct async_graphql::Response
source · #[non_exhaustive]pub struct Response {
pub data: Value,
pub extensions: BTreeMap<String, Value>,
pub cache_control: CacheControl,
pub errors: Vec<ServerError>,
pub http_headers: HeaderMap,
}
Expand description
Query response
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.data: Value
Data of query result
extensions: BTreeMap<String, Value>
Extensions result
cache_control: CacheControl
Cache control value
errors: Vec<ServerError>
Errors
http_headers: HeaderMap
HTTP headers
Implementations
sourceimpl Response
impl Response
sourcepub fn from_errors(errors: Vec<ServerError>) -> Self
pub fn from_errors(errors: Vec<ServerError>) -> Self
Create a response from some errors.
sourcepub fn extension(self, name: impl Into<String>, value: Value) -> Self
pub fn extension(self, name: impl Into<String>, value: Value) -> Self
Set the extension result of the response.
sourcepub fn http_headers(self, http_headers: HeaderMap) -> Self
pub fn http_headers(self, http_headers: HeaderMap) -> Self
Set the http headers of the response.
sourcepub fn cache_control(self, cache_control: CacheControl) -> Self
pub fn cache_control(self, cache_control: CacheControl) -> Self
Set the cache control of the response.
sourcepub fn into_result(self) -> Result<Self, Vec<ServerError>>
pub fn into_result(self) -> Result<Self, Vec<ServerError>>
Extract the error from the response. Only if the error
field is empty
will this return Ok
.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Response
impl<'de> Deserialize<'de> for Response
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Response> for BatchResponse
impl From<Response> for BatchResponse
impl StructuralPartialEq for Response
Auto Trait Implementations
impl !RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl !UnwindSafe for Response
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more