A bunch of fun stuff.

parent 795492d0
Pipeline #77118081 failed with stages
in 3 minutes and 50 seconds
......@@ -13,3 +13,7 @@ documentation = "https://docs.rs/access-control"
gitlab = { repository = "demilletech/access-control.rs" }
[dependencies]
async-trait = { version = "0.1.10", optional = true }
[features]
async = ["async-trait"]
#[cfg(feature = "async")]
use async_trait::async_trait;
#[cfg(feature = "async")]
use std::future::Future;
pub struct User<Id>
where
Id: Eq,
{
id: Id,
}
pub trait DataProvider<Id>
where
Id: Eq,
{
type Error;
fn get_user_info(&self, id: &Id) -> Result<User<Id>, Self::Error>;
}
#[cfg(feature = "async")]
#[async_trait]
pub trait AsyncDataProvider<Id>
where
Id: Eq,
{
type Error;
async fn get_user_info(&self, id: &Id) -> Result<User<Id>, Self::Error>;
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
#![warn(clippy::all)]
#![cfg_attr(feature = "async", feature(async_await))]
pub mod data;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment