use crate::span::Span;
use crate::status::Status;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NodeId(pub usize);
#[derive(Debug, Clone)]
pub(crate) struct Node<C> {
pub span: Span,
pub ctx: C,
pub status: Status,
pub depth: usize,
pub parent: Option<NodeId>,
pub children: Vec<NodeId>,
pub attempts: usize,
pub alive: bool,
}
impl<C> Node<C> {
pub(crate) fn new_root(span: Span, ctx: C) -> Self {
Self {
span,
ctx,
status: Status::Unparsed,
depth: 0,
parent: None,
children: Vec::new(),
attempts: 0,
alive: true,
}
}
}