Skip to main content

ic_query/sns/report/model/sorts/
neurons.rs

1//! Module: sns::report::model::sorts::neurons
2//!
3//! Responsibility: SNS neuron report sort model.
4//! Does not own: CLI parsing, cache loading, or row ordering implementation.
5//! Boundary: names supported report-level sorting for SNS neuron listings.
6
7///
8/// SnsNeuronsSort
9///
10/// Report-model sort selector for SNS neuron listings.
11///
12
13#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
14pub enum SnsNeuronsSort {
15    #[default]
16    Api,
17    Id,
18    Stake,
19    Maturity,
20    Created,
21}
22
23impl SnsNeuronsSort {
24    /// Return the stable label used in text and JSON reports.
25    #[must_use]
26    pub const fn as_str(self) -> &'static str {
27        match self {
28            Self::Api => "api",
29            Self::Id => "id",
30            Self::Stake => "stake",
31            Self::Maturity => "maturity",
32            Self::Created => "created",
33        }
34    }
35
36    /// Return whether this sort requires a complete local snapshot.
37    #[must_use]
38    pub const fn uses_cache(self) -> bool {
39        !matches!(self, Self::Api)
40    }
41}