pub struct DomainInfo {
pub name: String,
pub size: Option<usize>,
pub domain_type: DomainType,
pub constraints: Vec<String>,
pub metadata: HashMap<String, String>,
}Expand description
Represents a domain constraint for a variable.
Fields§
§name: StringDomain name (e.g., “Person”, “Integer”, “Real”)
size: Option<usize>Domain size (None for infinite domains like Real)
domain_type: DomainTypeDomain type category
constraints: Vec<String>Additional constraints (e.g., “positive”, “bounded”)
metadata: HashMap<String, String>Optional metadata for custom domains
Implementations§
Source§impl DomainInfo
impl DomainInfo
Sourcepub fn new(name: impl Into<String>, domain_type: DomainType) -> Self
pub fn new(name: impl Into<String>, domain_type: DomainType) -> Self
Create a new domain with given name and type.
Sourcepub fn finite(name: impl Into<String>, size: usize) -> Self
pub fn finite(name: impl Into<String>, size: usize) -> Self
Create a finite domain with a specific size.
Sourcepub fn with_constraint(self, constraint: impl Into<String>) -> Self
pub fn with_constraint(self, constraint: impl Into<String>) -> Self
Add a constraint to this domain.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata to this domain.
Sourcepub fn is_compatible_with(&self, other: &DomainInfo) -> bool
pub fn is_compatible_with(&self, other: &DomainInfo) -> bool
Check if this domain is compatible with another.
Two domains are compatible if:
- They have the same type category
- Finite domains have compatible sizes
- Constraints don’t conflict
Sourcepub fn can_cast_to(&self, target: &DomainInfo) -> bool
pub fn can_cast_to(&self, target: &DomainInfo) -> bool
Check if this domain can be cast to another domain.
Casting rules:
- Boolean -> Integer -> Real
- Finite -> Integer (if size fits)
- Same type is always compatible
Trait Implementations§
Source§impl Clone for DomainInfo
impl Clone for DomainInfo
Source§fn clone(&self) -> DomainInfo
fn clone(&self) -> DomainInfo
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 DomainInfo
impl Debug for DomainInfo
Source§impl<'de> Deserialize<'de> for DomainInfo
impl<'de> Deserialize<'de> for DomainInfo
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
Source§impl PartialEq for DomainInfo
impl PartialEq for DomainInfo
Source§impl Serialize for DomainInfo
impl Serialize for DomainInfo
impl StructuralPartialEq for DomainInfo
Auto Trait Implementations§
impl Freeze for DomainInfo
impl RefUnwindSafe for DomainInfo
impl Send for DomainInfo
impl Sync for DomainInfo
impl Unpin for DomainInfo
impl UnwindSafe for DomainInfo
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