[][src]Trait canrun::domains::Domain

pub trait Domain<'a>: Clone + Debug {
    type Value: Debug + Clone + 'a;
    fn new() -> Self;
fn unify_domain_values(
        state: State<'a, Self>,
        a: Self::Value,
        b: Self::Value
    ) -> Option<State<'a, Self>>; }

Manage values for a set of specific types.

Works with the DomainType<T> trait to allow access to actual values.

Domains are typically generated with the domain! macro. There isn't currently much use case for interacting with a domain directly in user code. The only reason it is public is to allow implementing custom domains through the macro.

use canrun::{State, Goal, unify, var};

canrun::domain! {
    MyDomain {
        i32
    }
}

let x = var();
let state: State<MyDomain> = State::new();
let goal: Goal<MyDomain> = unify(x, 1);

Associated Types

type Value: Debug + Clone + 'a

An individual value that may contain any of the valid types in this domain.

Typically for internal use.

Loading content...

Required methods

fn new() -> Self

Create a new, valid domain.

Typically for internal use.

fn unify_domain_values(
    state: State<'a, Self>,
    a: Self::Value,
    b: Self::Value
) -> Option<State<'a, Self>>

Apply .unify() to two domain level values.

The unification will fail if the inner values are not of the same type. This should not be able to happen.

Typically for internal use.

Loading content...

Implementors

impl<'a> Domain<'a> for Collections[src]

type Value = CollectionsValue

impl<'a> Domain<'a> for I32[src]

type Value = I32Value

impl<'a> Domain<'a> for TupleI32[src]

type Value = TupleI32Value

Loading content...