Skip to main content

formualizer_eval/formula_plane/
ids.rs

1//! Dependency-light Formula Plane V2 descriptors.
2//!
3//! See FORMULA_PLANE_V2.md.
4
5#[cfg(feature = "serde")]
6use serde::{Deserialize, Serialize};
7
8/// Opaque identifier for a future Formula Plane V2 template.
9#[repr(transparent)]
10#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
12pub struct FormulaTemplateId(pub(crate) u32);
13
14impl FormulaTemplateId {
15    /// Return the request-local diagnostic value for this opaque identifier.
16    ///
17    /// The value must not be persisted or compared across engine sessions.
18    pub const fn as_u32(self) -> u32 {
19        self.0
20    }
21}
22
23/// Opaque identifier for a future Formula Plane V2 placement or run.
24#[repr(transparent)]
25#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
26#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
27pub struct FormulaRunId(pub(crate) u32);
28
29impl FormulaRunId {
30    /// Return the request-local diagnostic value for this opaque identifier.
31    ///
32    /// The value must not be persisted or compared across engine sessions.
33    pub const fn as_u32(self) -> u32 {
34        self.0
35    }
36}
37
38/// 128-bit formula-content fingerprint; construction is deferred.
39#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
40#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
41pub struct FormulaFingerprint {
42    pub hi: u64,
43    pub lo: u64,
44}
45
46/// 128-bit dependency-shape fingerprint; construction is deferred.
47#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
48#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
49pub struct DependencyShapeFingerprint {
50    pub hi: u64,
51    pub lo: u64,
52}