#![expect(clippy::todo, reason = "skeleton: #6833")]
use core::marker::PhantomData;
use crate::id::AnalysisId;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct Demand(u64);
impl Demand {
pub const NONE: Self = Self(0);
#[must_use]
pub const fn with(self, group: AnalysisId) -> Self {
let _ = group;
todo!()
}
#[must_use]
pub const fn contains(self, group: AnalysisId) -> bool {
let _ = group;
todo!()
}
}
pub trait FactGroup: Sized + 'static {
const ID: AnalysisId;
const DEPENDS_ON: Demand;
type Key;
type Value;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FactError {
Unregistered(AnalysisId),
Cycle(AnalysisId),
}
#[derive(Debug)]
pub struct FactManager<'a, A: ?Sized> {
computed: Demand,
_artifact: PhantomData<&'a A>,
}
impl<A: ?Sized> FactManager<'_, A> {
#[must_use]
pub const fn new() -> Self {
Self {
computed: Demand::NONE,
_artifact: PhantomData,
}
}
#[must_use]
pub const fn computed(&self) -> Demand {
self.computed
}
pub fn compute(&mut self, artifact: &A, demand: Demand) -> Result<Demand, FactError> {
let _ = (artifact, demand);
todo!()
}
}
impl<A: ?Sized> Default for FactManager<'_, A> {
fn default() -> Self {
Self::new()
}
}