method Flag.set
Replaces the rules of layer ("on", "off", "25%", "percent=25,by=tenant" or JSON).
Example:
dynamic Features {
beta: Flag = Flag.off
}
fn main() io {
let f = Features.get()
let ann = Principal.User("ann", [], Map.new(), false, none)
f.beta.set("on")!
print("{f.beta.on(r#for: ann)}")
match f.beta.set("sometimes") {
DynError _ => print("rejected")
_ => print("accepted")
}
}Вывод
true rejected
pub(api) fn set(text: str, layer: DynScope = .Global) -> () | DynErrorС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
text | str |
layer | DynScope = .Global |
Возвращает
()
Ошибки
DynError@error- `DynError` for rules that do not parse or when the policy refuses the caller.
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/dynconf.oxl:853