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

pub trait CacheHttp {
    fn http(&self) -> &Http;

    fn cache(&self) -> Option<&CacheRwLock> { ... }
}

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

The types Context, CacheRwLock, 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

fn http(&self) -> &Http

Loading content...

Provided methods

fn cache(&self) -> Option<&CacheRwLock>

Loading content...

Implementations on Foreign Types

impl<'_, '_> CacheHttp for (&'_ CacheRwLock, &'_ Http)[src]

Loading content...

Implementors

impl CacheHttp for Context[src]

impl<'_> CacheHttp for &'_ Http[src]

impl<'_> CacheHttp for &'_ Context[src]

impl<'_> CacheHttp for &'_ mut Context[src]

impl<'_, '_> CacheHttp for &'_ &'_ mut Context[src]

Loading content...