]> Repositorios git - scryer-prolog.git/commitdiff
Add interfaces for QueryState methods
authorbakaq <[email protected]>
Mon, 30 Sep 2024 02:42:11 +0000 (23:42 -0300)
committerbakaq <[email protected]>
Sun, 8 Dec 2024 23:18:06 +0000 (20:18 -0300)
src/machine/lib_machine.rs

index 5f0f4213505eb8693ff55605663470ead24faa56..04cfb55c2b5bcae8a34946543f2b29d4fb49c9bb 100644 (file)
@@ -23,6 +23,25 @@ pub struct QueryState<'a> {
     called: bool,
 }
 
+impl QueryState<'_> {
+    /// True if the query fails.
+    ///
+    /// Consumes the query. Gives [`false`] if an exception occurs.
+    pub fn fails(&mut self) -> bool {
+        todo!()
+    }
+
+    /// True if the query maybe succeeded.
+    ///
+    /// If a leaf answer has residual goals, it's only successful if the constraints they represent
+    /// are satisfiable.
+    ///
+    /// Consumes the query. Gives [`false`] if an exception occurs.
+    pub fn maybe_suceeded() -> bool {
+        todo!()
+    }
+}
+
 impl Drop for QueryState<'_> {
     fn drop(&mut self) {
         // This may be wrong if the iterator is not fully consumend, but from testing it seems