pub struct DeploymentRoles { /* private fields */ }Expand description
The set of Marktrolles this makod deployment fills.
Used by EngineModule::register_pids_with_roles to conditionally register
PID routes based on which roles are active. Modules check
roles.contains(Marktrolle::Nb) before registering role-specific PIDs.
§Constructors
DeploymentRoles::all()— registers everything regardless of role (useful for development and single-role deployments, default).DeploymentRoles::from_roles— explicit set for multi-role conflict resolution.- Convenience methods:
nb(),lf(),msb(),nmsb()etc.
§Conflict guard
When two modules both register the same PID to different workflow names,
EngineBuilder::build will detect the conflict and panic. Set exclusive roles
to ensure only one workflow is registered per shared PID:
// NB deployment: GPKE registers 19001/19002 → gpke-konfiguration
// nMSB deployment: WiM registers 19001/19002 → wim-geraeteubernahme
// Combined (conflict!): set roles to prevent double-registration:
use mako_engine::marktrolle::{DeploymentRoles, Marktrolle};
let roles = DeploymentRoles::from_roles([Marktrolle::Nb]);
// Now only GPKE registers 19001/19002; WiM skips its nMSB-conditional block.Implementations§
Source§impl DeploymentRoles
impl DeploymentRoles
Sourcepub fn all() -> Self
pub fn all() -> Self
All roles active — contains always returns true.
The default for EngineBuilder. Modules register all their PIDs
unconditionally, identical to the pre-role-aware behavior.
Warning: if two modules register the same PID to different workflows
and all() is active, the conflict guard in PidRouter will panic at
build time. Use from_roles to specify exactly which roles apply.
Sourcepub fn from_roles(roles: impl IntoIterator<Item = Marktrolle>) -> Self
pub fn from_roles(roles: impl IntoIterator<Item = Marktrolle>) -> Self
Construct from an explicit set of active roles.
Only modules whose role-conditional PID blocks include at least one of
these roles will register those PIDs. All non-role-conditional PID blocks
(i.e., those that don’t call roles.contains(...)) are always registered.
Sourcepub fn contains(&self, role: Marktrolle) -> bool
pub fn contains(&self, role: Marktrolle) -> bool
Return true when role is active.
Always returns true for DeploymentRoles::all().
Sourcepub fn is_all(&self) -> bool
pub fn is_all(&self) -> bool
Return true when this is the all() sentinel (no explicit role list).
Sourcepub fn with(self, role: Marktrolle) -> Self
pub fn with(self, role: Marktrolle) -> Self
Add a role to an existing set, returning a new DeploymentRoles.
Trait Implementations§
Source§impl Clone for DeploymentRoles
impl Clone for DeploymentRoles
Source§fn clone(&self) -> DeploymentRoles
fn clone(&self) -> DeploymentRoles
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeploymentRoles
impl Debug for DeploymentRoles
Source§impl Default for DeploymentRoles
impl Default for DeploymentRoles
Source§fn default() -> Self
fn default() -> Self
Defaults to all — every role is considered active.
This preserves backward-compatible behavior (all PIDs registered) for
deployments that have not yet configured explicit roles. Set explicit
roles via DeploymentRoles::from_roles for multi-role conflict safety.