Trait LocalConstraint

Source
pub trait LocalConstraint:
    Any
    + Display
    + Clone {
    const CHR_RULES: &'static str;

    // Required methods
    fn parse(s: &str) -> IResult<&str, Self>;
    fn collect<'a>(fun: &Annotated<'a, &'a ItemFn>) -> Vec<Self>;
}
Expand description

Abstract encoding of a Local Constraint

Required Associated Constants§

Source

const CHR_RULES: &'static str

static CHR rules for the constraint system

Required Methods§

Source

fn parse(s: &str) -> IResult<&str, Self>

parse a single constraint rule

Source

fn collect<'a>(fun: &Annotated<'a, &'a ItemFn>) -> Vec<Self>

Collect CHR rules from a function definition

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl LocalConstraint for AliasConstraints

Source§

const CHR_RULES: &'static str = ":- use_module(library(chr)).\r\n:- chr_constraint alias/2, assign/2, ref/1.\r\n\r\n/* set semantics for aliasing */\r\nalias(A,B) \\ alias(A,B) <=> true.\r\n\r\n/* propagating the aliasing */\r\nalias(Q, P), alias(R, Q) ==> alias(R, P).\r\n\r\n/* if P is reference type and Q must be a reference type (and vice versa)\r\nthen assigning Q = P means aliasing P to Q */\r\nref(P) \\ assign(Q, P) <=> alias(Q, P).\r\nref(Q) \\ assign(Q, P) <=> alias(Q, P).\r\n"