pub struct Any { /* private fields */ }Expand description
A Goal that yields a state for every successful
sub-goal.
See the any! macro for a more ergonomic way to
construct static Any goals.
Also implements From<Vec<Rc<dyn Goal>>> and FromIterator<Rc<dyn Goal>>/
§Example
use canrun::{any, unify, LVar, Query};
use canrun::goals::{Goal, Any};
use std::rc::Rc;
let x = LVar::new();
let goals: Vec<Rc<dyn Goal>> = vec![
Rc::new(unify(x, 1)),
Rc::new(unify(x, 2)),
Rc::new(unify(x, 3)),
];
let goal = Any::from(goals);
let result: Vec<_> = goal.query(x).collect();
assert_eq!(result, vec![1, 2, 3])Trait Implementations§
Auto Trait Implementations§
impl Freeze for Any
impl !RefUnwindSafe for Any
impl !Send for Any
impl !Sync for Any
impl Unpin for Any
impl !UnwindSafe for Any
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more