pub struct LinksConfig {
pub entities: Vec<EntityConfig>,
pub links: Vec<LinkDefinition>,
pub validation_rules: Option<HashMap<String, Vec<ValidationRule>>>,
}Expand description
Complete configuration for the links system
Fields§
§entities: Vec<EntityConfig>List of entity configurations
links: Vec<LinkDefinition>List of link definitions
validation_rules: Option<HashMap<String, Vec<ValidationRule>>>Optional validation rules (link_type -> rules)
Implementations§
Source§impl LinksConfig
impl LinksConfig
Sourcepub fn from_yaml_file(path: &str) -> Result<Self>
pub fn from_yaml_file(path: &str) -> Result<Self>
Load configuration from a YAML file
Sourcepub fn from_yaml_str(yaml: &str) -> Result<Self>
pub fn from_yaml_str(yaml: &str) -> Result<Self>
Load configuration from a YAML string
Sourcepub fn merge(configs: Vec<LinksConfig>) -> Self
pub fn merge(configs: Vec<LinksConfig>) -> Self
Merge multiple configurations into one
Rules:
- Entities: Combined from all configs, duplicates (by singular name) use last definition
- Links: Combined from all configs, duplicates (by link_type+source+target) use last definition
- Validation rules: Merged by link_type, rules combined for each link type
Sourcepub fn is_valid_link(
&self,
link_type: &str,
source_type: &str,
target_type: &str,
) -> bool
pub fn is_valid_link( &self, link_type: &str, source_type: &str, target_type: &str, ) -> bool
Validate if a link combination is allowed
If no validation rules are defined, all combinations are allowed (permissive mode)
Sourcepub fn find_link_definition(
&self,
link_type: &str,
source_type: &str,
target_type: &str,
) -> Option<&LinkDefinition>
pub fn find_link_definition( &self, link_type: &str, source_type: &str, target_type: &str, ) -> Option<&LinkDefinition>
Find a link definition
Sourcepub fn default_config() -> Self
pub fn default_config() -> Self
Create a default configuration for testing
Trait Implementations§
Source§impl Clone for LinksConfig
impl Clone for LinksConfig
Source§fn clone(&self) -> LinksConfig
fn clone(&self) -> LinksConfig
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 moreSource§impl Debug for LinksConfig
impl Debug for LinksConfig
Source§impl<'de> Deserialize<'de> for LinksConfig
impl<'de> Deserialize<'de> for LinksConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LinksConfig
impl RefUnwindSafe for LinksConfig
impl Send for LinksConfig
impl Sync for LinksConfig
impl Unpin for LinksConfig
impl UnwindSafe for LinksConfig
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