[−][src]Struct async_graphql::CacheControl
Cache control values
Examples
use async_graphql::*; struct QueryRoot; #[Object(cache_control(max_age = 60))] impl QueryRoot { #[field(cache_control(max_age = 30))] async fn value1(&self) -> i32 { unimplemented!() } #[field(cache_control(private))] async fn value2(&self) -> i32 { unimplemented!() } } #[async_std::main] async fn main() { let schema = Schema::new(QueryRoot, EmptyMutation, EmptySubscription); assert_eq!(schema.query("{ value1 }").unwrap().cache_control(), CacheControl { public: true, max_age: 30 }); assert_eq!(schema.query("{ value2 }").unwrap().cache_control(), CacheControl { public: false, max_age: 60 }); assert_eq!(schema.query("{ value1 value2 }").unwrap().cache_control(), CacheControl { public: false, max_age: 30 }); }
Fields
public: bool
Scope is public, default is true
max_age: usize
Cache max age, default is 0.
Methods
impl CacheControl
[src]
Trait Implementations
impl Clone for CacheControl
[src]
fn clone(&self) -> CacheControl
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for CacheControl
[src]
impl Debug for CacheControl
[src]
impl Default for CacheControl
[src]
impl Eq for CacheControl
[src]
impl PartialEq<CacheControl> for CacheControl
[src]
fn eq(&self, other: &CacheControl) -> bool
[src]
fn ne(&self, other: &CacheControl) -> bool
[src]
impl StructuralEq for CacheControl
[src]
impl StructuralPartialEq for CacheControl
[src]
Auto Trait Implementations
impl RefUnwindSafe for CacheControl
impl Send for CacheControl
impl Sync for CacheControl
impl Unpin for CacheControl
impl UnwindSafe for CacheControl
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,