Skip to main content

sim_table_db/
citizen.rs

1//! Citizen descriptor for the db-directory class, mapping a directory node to
2//! and from its serialized path form via [`db_dir_class_symbol`] and
3//! [`DbDirDescriptor`].
4
5use sim_citizen_derive::Citizen;
6use sim_kernel::Symbol;
7
8/// Serialized form of a [`DbDir`](crate::DbDir): the citizen descriptor holding
9/// the directory node's path within the store.
10///
11/// Produced when a directory node is encoded and read back when a `table/DbDir`
12/// constructor is decoded. It records location only, not the store contents.
13#[derive(Clone, Debug, Default, PartialEq, Citizen)]
14#[citizen(symbol = "table/DbDir", version = 0)]
15pub struct DbDirDescriptor {
16    /// Path segments from the store root to this directory node, serialized via
17    /// the shared `sim_table_core::citizen_fields::path_segments` codec.
18    #[citizen(with = "sim_table_core::citizen_fields::path_segments")]
19    pub path: Vec<String>,
20}
21
22/// The fully qualified class symbol (`table/DbDir`) for the db-directory
23/// citizen.
24pub fn db_dir_class_symbol() -> Symbol {
25    Symbol::qualified("table", "DbDir")
26}