Skip to content

Commit

Permalink
Implement CacheHttp for Arc<Http> (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakelezz authored Jul 13, 2019
1 parent 67f5e3d commit 1a209e8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use crate::model::prelude::*;
use self::{request::Request};
use std::{
fs::File,
sync::Arc,
path::{Path, PathBuf},
};

Expand Down Expand Up @@ -110,11 +111,16 @@ impl CacheHttp for (&CacheRwLock, &Http) {
fn http(&self) -> &Http { &self.1 }
}

#[cfg(feature = "http")]
impl CacheHttp for &Http {
#[cfg(feature = "http")]
fn http(&self) -> &Http { *self }
}

#[cfg(feature = "http")]
impl CacheHttp for Arc<Http> {
fn http(&self) -> &Http { &*self }
}

#[cfg(all(feature = "cache", feature = "http"))]
impl AsRef<CacheRwLock> for (&CacheRwLock, &Http) {
fn as_ref(&self) -> &CacheRwLock {
Expand Down

0 comments on commit 1a209e8

Please sign in to comment.