pub struct DomainHierarchy { /* private fields */ }Expand description
Domain hierarchy tracking subtype relationships
Implementations§
Source§impl DomainHierarchy
impl DomainHierarchy
pub fn new() -> Self
Sourcepub fn add_subtype(
&mut self,
subdomain: impl Into<String>,
parent: impl Into<String>,
)
pub fn add_subtype( &mut self, subdomain: impl Into<String>, parent: impl Into<String>, )
Add a subtype relationship: subdomain <: parent
Sourcepub fn is_subtype(&self, subdomain: &str, parent: &str) -> bool
pub fn is_subtype(&self, subdomain: &str, parent: &str) -> bool
Check if subdomain is a subtype of parent (directly or transitively)
Sourcepub fn get_parent(&self, domain: &str) -> Option<&str>
pub fn get_parent(&self, domain: &str) -> Option<&str>
Get the direct parent of a domain, if any
Sourcepub fn get_ancestors(&self, domain: &str) -> Vec<String>
pub fn get_ancestors(&self, domain: &str) -> Vec<String>
Get all ancestors of a domain (parent, grandparent, etc.)
Sourcepub fn get_descendants(&self, domain: &str) -> Vec<String>
pub fn get_descendants(&self, domain: &str) -> Vec<String>
Get all descendants of a domain
Sourcepub fn validate_acyclic(&self) -> Result<()>
pub fn validate_acyclic(&self) -> Result<()>
Validate that there are no cycles in the hierarchy
Sourcepub fn least_common_supertype(
&self,
domain1: &str,
domain2: &str,
) -> Option<String>
pub fn least_common_supertype( &self, domain1: &str, domain2: &str, ) -> Option<String>
Find the least common supertype of two domains
Sourcepub fn all_domains(&self) -> Vec<String>
pub fn all_domains(&self) -> Vec<String>
Get all domains in the hierarchy (both subdomains and their parents).
Trait Implementations§
Source§impl Clone for DomainHierarchy
impl Clone for DomainHierarchy
Source§fn clone(&self) -> DomainHierarchy
fn clone(&self) -> DomainHierarchy
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 DomainHierarchy
impl Debug for DomainHierarchy
Source§impl Default for DomainHierarchy
impl Default for DomainHierarchy
Source§impl<'de> Deserialize<'de> for DomainHierarchy
impl<'de> Deserialize<'de> for DomainHierarchy
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 DomainHierarchy
impl RefUnwindSafe for DomainHierarchy
impl Send for DomainHierarchy
impl Sync for DomainHierarchy
impl Unpin for DomainHierarchy
impl UnwindSafe for DomainHierarchy
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