1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use serde::{Deserialize, Serialize};

use super::ExecutorId;

/// Идентификатор сервиса
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct ComponentId(String);

impl ComponentId {
    pub fn new(service_id: &ExecutorId, prefix: &str) -> Self {
        let id = format!("{service_id}::{prefix}");
        Self(id)
    }
}

impl std::fmt::Display for ComponentId {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}