#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Budget {
pub max_depth: usize,
pub max_nodes: usize,
}
impl Budget {
pub const DEFAULT: Self = Self {
max_depth: 64,
max_nodes: 1_000_000,
};
#[must_use]
pub const fn with_depth(max_depth: usize) -> Self {
Self {
max_depth,
..Self::DEFAULT
}
}
}
impl Default for Budget {
fn default() -> Self {
Self::DEFAULT
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum Stop {
Exhausted,
DepthLimit,
NodeLimit,
}
impl Stop {
#[must_use]
pub const fn is_complete(self) -> bool {
matches!(self, Self::Exhausted)
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Walk {
pub visited: Vec<crate::value::EntityId>,
pub stop: Stop,
pub revisited: Vec<crate::value::EntityId>,
}