relay_knowledge/domain/core/
entity.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5pub struct KnowledgeEntity {
6 id: String,
7 label: String,
8}
9
10impl KnowledgeEntity {
11 pub fn new(id: impl Into<String>, label: impl Into<String>) -> Self {
13 Self {
14 id: id.into(),
15 label: label.into(),
16 }
17 }
18
19 pub fn id(&self) -> &str {
21 &self.id
22 }
23
24 pub fn label(&self) -> &str {
26 &self.label
27 }
28}
29
30#[cfg(test)]
31#[path = "entity_tests.rs"]
32mod tests;