made_core/ports/
bind_outcome.rs1use crate::value_objects::IntegratorBinding;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum BindOutcome {
6 Bound(IntegratorBinding),
8 AlreadyBound(IntegratorBinding),
10 Replaced {
12 previous: Box<IntegratorBinding>,
13 current: Box<IntegratorBinding>,
14 },
15 AlreadyExists { existing: Box<IntegratorBinding> },
17}
18
19impl BindOutcome {
20 #[must_use]
22 pub const fn current(&self) -> Option<&IntegratorBinding> {
23 match self {
24 Self::Bound(binding) | Self::AlreadyBound(binding) => Some(binding),
25 Self::Replaced { current, .. } => Some(current),
26 Self::AlreadyExists { .. } => None,
27 }
28 }
29
30 #[must_use]
31 pub const fn is_bound(&self) -> bool {
32 !matches!(self, Self::AlreadyExists { .. })
33 }
34}