1use crate::engine::Engine;
17use crate::goal::Goal;
18use crate::lterm::LTerm;
19use crate::state::constraint::Constraint;
20use crate::state::{SMap, SResult, State};
21use std::fmt;
22use std::fmt::Debug;
23use std::hash::Hash;
24use std::rc::Rc;
25
26pub trait User: Debug + Clone + Default + 'static {
27 type UserTerm: Debug + Clone + Hash + PartialEq + Eq;
28
29 type UserContext: Debug;
32
33 fn process_extension<E: Engine<Self>>(
35 state: State<Self, E>,
36 _extension: &SMap<Self, E>,
37 ) -> SResult<Self, E> {
38 Ok(state)
39 }
40
41 fn unify<E: Engine<Self>>(
43 _state: State<Self, E>,
44 _extension: &mut SMap<Self, E>,
45 _uwalk: LTerm<Self, E>,
46 _vwalk: LTerm<Self, E>,
47 ) -> SResult<Self, E> {
48 Err(())
49 }
50
51 fn with_constraint<E: Engine<Self>>(
53 _state: &mut State<Self, E>,
54 _constraint: &Rc<dyn Constraint<Self, E>>,
55 ) {
56 }
57
58 fn take_constraint<E: Engine<Self>>(
60 _state: &mut State<Self, E>,
61 _constraint: &Rc<dyn Constraint<Self, E>>,
62 ) {
63 }
64
65 fn enforce_constraints<E: Engine<Self>>(_x: LTerm<Self, E>) -> Goal<Self, E> {
68 Goal::Succeed
69 }
70
71 fn finalize<E: Engine<Self>>(_state: &mut State<Self, E>) {}
72
73 fn reify<E: Engine<Self>>(_state: &mut State<Self, E>) {}
74}
75
76#[derive(Debug, Clone)]
77pub struct DefaultUser {}
78
79impl DefaultUser {
80 pub fn new() -> DefaultUser {
81 DefaultUser {}
82 }
83}
84
85impl fmt::Display for DefaultUser {
86 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
87 write!(f, "")
88 }
89}
90
91impl Default for DefaultUser {
92 fn default() -> DefaultUser {
93 DefaultUser {}
94 }
95}
96
97impl User for DefaultUser {
98 type UserTerm = ();
99 type UserContext = ();
100}