hydro_lang/live_collections/
boundedness.rs1use sealed::sealed;
5
6use super::keyed_singleton::KeyedSingletonBound;
7use crate::compile::ir::BoundKind;
8use crate::live_collections::singleton::SingletonBound;
9
10#[sealed]
14pub trait Boundedness:
15 SingletonBound<UnderlyingBound = Self> + KeyedSingletonBound<UnderlyingBound = Self>
16{
17 const BOUNDED: bool;
19
20 const BOUND_KIND: BoundKind = if Self::BOUNDED {
22 BoundKind::Bounded
23 } else {
24 BoundKind::Unbounded
25 };
26}
27
28pub enum Unbounded {}
31
32#[sealed]
33impl Boundedness for Unbounded {
34 const BOUNDED: bool = false;
35}
36
37pub enum Bounded {}
40
41#[sealed]
42impl Boundedness for Bounded {
43 const BOUNDED: bool = true;
44}
45
46#[sealed]
47#[diagnostic::on_unimplemented(
48 message = "The input collection must be bounded (`Bounded`), but has bound `{Self}`. Strengthen the boundedness upstream or consider a different API.",
49 label = "required here",
50 note = "To intentionally process a non-deterministic snapshot or batch, you may want to use a `sliced!` region. This introduces non-determinism so avoid unless necessary."
51)]
52pub trait IsBounded: Boundedness {}
54
55#[sealed]
56#[diagnostic::do_not_recommend]
57impl IsBounded for Bounded {}