pub struct ProjectConfig {
pub effect_policies: HashMap<String, EffectPolicy>,
}Expand description
Project-level configuration loaded from aver.toml.
Fields§
§effect_policies: HashMap<String, EffectPolicy>Effect namespace → policy. Absence of a key means “allow all”.
Implementations§
Source§impl ProjectConfig
impl ProjectConfig
Sourcepub fn load_from_dir(dir: &Path) -> Result<Option<Self>, String>
pub fn load_from_dir(dir: &Path) -> Result<Option<Self>, String>
Try to load aver.toml from the given directory.
Returns Ok(None) if the file does not exist.
Returns Err if the file exists but is malformed (parse errors, bad types).
Sourcepub fn parse(content: &str) -> Result<Self, String>
pub fn parse(content: &str) -> Result<Self, String>
Parse the TOML content into a ProjectConfig.
Sourcepub fn check_http_host(
&self,
method_name: &str,
url_str: &str,
) -> Result<(), String>
pub fn check_http_host( &self, method_name: &str, url_str: &str, ) -> Result<(), String>
Check whether an HTTP call to url_str is allowed by the policy.
Returns Ok(()) if allowed, Err(message) if denied.
Trait Implementations§
Source§impl Clone for ProjectConfig
impl Clone for ProjectConfig
Source§fn clone(&self) -> ProjectConfig
fn clone(&self) -> ProjectConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ProjectConfig
impl RefUnwindSafe for ProjectConfig
impl Send for ProjectConfig
impl Sync for ProjectConfig
impl Unpin for ProjectConfig
impl UnsafeUnpin for ProjectConfig
impl UnwindSafe for ProjectConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more