made_core/ports/bind_replacement.rs
1/// Whether binding an integrator may displace one that is already there.
2///
3/// Named rather than a bare flag: the two answers are "take over" and
4/// "tell me who has it", and a call that guessed wrong would either
5/// steal a live host's work or refuse a legitimate hand-over.
6#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
7pub enum BindReplacement {
8 /// Refuse if a different binding is live for this scope.
9 #[default]
10 Refuse,
11 /// Displace the live binding and raise the fence.
12 Replace,
13}
14
15impl BindReplacement {
16 #[must_use]
17 pub const fn replaces(self) -> bool {
18 matches!(self, Self::Replace)
19 }
20}