[][src]Trait serenity::http::CacheHttp

pub trait CacheHttp: Send + Sync {
    pub fn http(&self) -> &Http;

    pub fn cache(&self) -> Option<&Arc<Cache>> { ... }
}

This trait will be required by functions that need Http and can optionally use a Cache to potentially avoid REST-requests.

The types Context, Cache, and Http implement this trait and thus passing these to functions expecting impl CacheHttp is possible.

In a situation where you have the cache-feature enabled but you do not pass a cache, the function will behave as if no cache-feature is active.

If you are calling a function that expects impl CacheHttp as argument and you wish to utilise the cache-feature but you got no access to a Context, you can pass a tuple of (CacheRwLock, Http).

Required methods

pub fn http(&self) -> &Http[src]

Loading content...

Provided methods

pub fn cache(&self) -> Option<&Arc<Cache>>[src]

Loading content...

Implementations on Foreign Types

impl<T> CacheHttp for &T where
    T: CacheHttp
[src]

impl CacheHttp for Arc<CacheAndHttp>[src]

impl CacheHttp for (&Arc<Cache>, &Http)[src]

impl CacheHttp for Arc<Http>[src]

Loading content...

Implementors

impl CacheHttp for Context[src]

impl CacheHttp for CacheAndHttp[src]

Loading content...