Crates.io | yaml-adapter |
lib.rs | yaml-adapter |
version | 1.0.0 |
source | src |
created_at | 2021-01-22 12:41:54.796413 |
updated_at | 2024-02-04 16:57:40.548145 |
description | a adapter which reads yaml format policy file for casbin repo |
homepage | https://github.com/casbin-rs/yaml-adapter |
repository | https://github.com/casbin-rs/yaml-adapter |
max_upload_size | |
id | 345304 |
size | 33,232 |
Yaml Adapter is a yaml adapter for Casbin-rs. With this library, Casbin can load policy from yaml fromat file or save policy into it with fully asynchronous support.
Add following to Cargo.toml
yaml-adapter = { version = "1.0.0", features = "runtime-async-std" }
async-std = "1.5.0"
for using tokio
yaml-adapter = { version = "1.0.0", features = "runtime-tokio" }
tokio = "0.3.1"
let adapter = YamlAdapter::new("examples/rbac_policy.yaml");
let e = Enforcer::new(m, adapter).await.unwrap();
for policy file configuration, please refer to example