Skip to main content

sim_lib_view/
citizen.rs

1use sim_citizen_derive::Citizen;
2use sim_kernel::{CapabilityName, Symbol};
3
4/// Registration record for a view lens, exposed as a runtime Citizen.
5#[derive(Clone, Debug, PartialEq, Citizen)]
6#[citizen(symbol = "view/LensDescriptor", version = 1)]
7pub struct ViewLensDescriptor {
8    /// Stable lens id.
9    pub id: Symbol,
10    /// Lens kind tag.
11    pub kind: Symbol,
12    /// Value classes this lens claims to render.
13    pub claimed_classes: Vec<Symbol>,
14    /// Capabilities the lens requires to run.
15    pub required_capabilities: Vec<CapabilityName>,
16    /// Whether this lens is the universal default fallback.
17    pub universal_default: bool,
18}
19
20impl Default for ViewLensDescriptor {
21    fn default() -> Self {
22        Self {
23            id: Symbol::new(crate::UNIVERSAL_DEFAULT_LENS),
24            kind: Symbol::new("view"),
25            claimed_classes: Vec::new(),
26            required_capabilities: Vec::new(),
27            universal_default: true,
28        }
29    }
30}
31
32/// Returns the class symbol for the view lens descriptor Citizen.
33pub fn view_lens_descriptor_class_symbol() -> Symbol {
34    Symbol::qualified("view", "LensDescriptor")
35}