add test for tokio and async-std

Signed-off-by: smrpn <samarpan_d@pp.iitr.ac.in>
3 files changed
tree: 6b8499a6db87b926ea428253eed085983be50c2f
  1. .github/
  2. examples/
  3. src/
  4. tests/
  5. .gitignore
  6. Cargo.lock
  7. Cargo.toml
  8. LICENSE
  9. README.md
README.md

json-adapter

Json Adapter is a json adapter for Casbin-rs. With this library, Casbin can load policy from json format file or save policy into it with fully asynchronous support.

Dependency

Add following to Cargo.toml

json-adapter = { version = "0.1.0", features = "runtime-async-std" }
async-std = "1.6.4"

for using tokio

json-adapter = { version = "0.1.0", features = "runtime-tokio" }
tokio = "1.2.0"

Examples

let adapter = JsonAdapter::new("examples/rbac_policy.json");
let e = Enforcer::new(m, adapter).await.unwrap();

for policy file configuration, please refer to example