async_trait creates an AsyncResovlver, that can live along-side Resolver

This commit is contained in:
Mina Galić 2020-05-18 23:34:25 +02:00
parent 42bfd3efb0
commit 7df1cbe7ba
Signed by: igalic
GPG key ID: ACFEFF7F6A123A86
2 changed files with 4 additions and 6 deletions

View file

@ -6,7 +6,7 @@ use async_trait::async_trait;
/// The `R` type is your resource repository (a database for instance) that will be passed to the
/// [`find`](Resolver::find) and [`endpoint`](Resolver::endpoint) functions.
#[async_trait]
pub trait Resolver {
pub trait AsyncResolver {
type Repo: Send;
/// Returns the domain name of the current instance.
async fn instance_domain<'a>(&self) -> &'a str;

View file

@ -5,16 +5,14 @@
use reqwest::{header::ACCEPT, Client};
use serde::{Deserialize, Serialize};
mod sync_trait;
pub use crate::sync_trait::*;
#[cfg(feature = "async")]
mod async_trait;
#[cfg(feature = "async")]
pub use crate::async_trait::*;
#[cfg(not(feature = "async"))]
mod sync_trait;
#[cfg(not(feature = "async"))]
pub use crate::sync_trait::*;
#[cfg(test)]
mod tests;