Skip to main content

made_core/value_objects/delivery/
host_destination.rs

1use serde::{Deserialize, Serialize};
2
3use super::{HostActivationMode, HostAddress, HostKind};
4
5/// Where an integrator lives, in terms the engine keeps opaque.
6///
7/// The address is never parsed and never executed: it is handed to the
8/// activation adapter as an environment value, and what it means is the
9/// operator's business. That is what keeps a payload from becoming a
10/// command.
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12pub struct HostDestination {
13    host_kind: HostKind,
14    address: HostAddress,
15    activation: HostActivationMode,
16}
17
18impl HostDestination {
19    #[must_use]
20    pub const fn new(
21        host_kind: HostKind,
22        address: HostAddress,
23        activation: HostActivationMode,
24    ) -> Self {
25        Self {
26            host_kind,
27            address,
28            activation,
29        }
30    }
31
32    #[must_use]
33    pub const fn host_kind(&self) -> &HostKind {
34        &self.host_kind
35    }
36
37    #[must_use]
38    pub const fn address(&self) -> &HostAddress {
39        &self.address
40    }
41
42    #[must_use]
43    pub const fn activation(&self) -> HostActivationMode {
44        self.activation
45    }
46}