From: bakaq Date: Mon, 30 Sep 2024 02:42:11 +0000 (-0300) Subject: Add interfaces for QueryState methods X-Git-Tag: v0.10.0~92^2~17 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=dc8348b843e0263347ca13d8675f309b127a5b93;p=scryer-prolog.git Add interfaces for QueryState methods --- diff --git a/src/machine/lib_machine.rs b/src/machine/lib_machine.rs index 5f0f4213..04cfb55c 100644 --- a/src/machine/lib_machine.rs +++ b/src/machine/lib_machine.rs @@ -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