1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use sim_citizen_derive::Citizen;
use sim_kernel::{CapabilityName, Symbol};
/// Serializable `skill/Card` projection of a [`SkillCard`].
///
/// Where [`SkillCard`] is a shape-bearing runtime handle, this descriptor is a
/// plain citizen value carrying only the serializable metadata, suitable for
/// transport across the runtime boundary.
///
/// [`SkillCard`]: crate::SkillCard
#[derive(Clone, Debug, PartialEq, Citizen)]
#[citizen(symbol = "skill/Card", version = 1)]
pub struct SkillCardDescriptor {
/// Stable string identifier for the skill.
pub id: String,
/// Symbol the skill is registered and called under.
pub symbol: Symbol,
/// Human-readable title.
pub title: String,
/// Human-readable description.
pub description: String,
/// Symbols naming the roles the skill plays.
pub roles: Vec<Symbol>,
/// Capabilities a caller must hold to invoke the skill.
pub capabilities: Vec<CapabilityName>,
/// Identifier of the transport that runs the skill.
pub transport_id: String,
/// Kind of the transport.
pub transport_kind: String,
/// Operation name the transport dispatches.
pub operation: String,
}
impl Default for SkillCardDescriptor {
fn default() -> Self {
Self {
id: "citizen-skill".to_owned(),
symbol: Symbol::qualified("skill", "citizen-skill"),
title: "Citizen Skill".to_owned(),
description: "Citizen fixture skill descriptor".to_owned(),
roles: vec![Symbol::new("tool")],
capabilities: vec![CapabilityName::new("skill.call.citizen-skill")],
transport_id: "fixture".to_owned(),
transport_kind: "fixture".to_owned(),
operation: "citizen-skill".to_owned(),
}
}
}
/// Returns the class symbol (`skill/Card`) for [`SkillCardDescriptor`].
pub fn skill_card_descriptor_class_symbol() -> Symbol {
Symbol::qualified("skill", "Card")
}