termivar_scanner/plugin/
metadata.rs1use serde::Serialize;
2
3use super::PluginCategory;
4
5#[derive(Clone)]
6pub(super) struct PluginDescriptor {
7 pub(super) id: String,
8 pub(super) name: String,
9 pub(super) version: String,
10 pub(super) description: String,
11 pub(super) author: String,
12 pub(super) category: PluginCategory,
13 pub(super) api_version: String,
14 pub(super) loaded_at: u64,
15}
16
17#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
19pub struct PluginMetadata {
20 pub(super) id: String,
21 pub(super) name: String,
22 pub(super) version: String,
23 pub(super) description: String,
24 pub(super) author: String,
25 pub(super) category: PluginCategory,
26 pub(super) api_version: String,
27 pub(super) enabled: bool,
28 pub(super) loaded_at: u64,
29 pub(super) execution_count: u64,
30 pub(super) success_count: u64,
31 pub(super) error_count: u64,
32}
33
34impl PluginMetadata {
35 pub fn id(&self) -> &str {
37 &self.id
38 }
39
40 pub fn name(&self) -> &str {
42 &self.name
43 }
44
45 pub fn version(&self) -> &str {
47 &self.version
48 }
49
50 pub fn description(&self) -> &str {
52 &self.description
53 }
54
55 pub fn author(&self) -> &str {
57 &self.author
58 }
59
60 pub const fn category(&self) -> PluginCategory {
62 self.category
63 }
64
65 pub fn api_version(&self) -> &str {
67 &self.api_version
68 }
69
70 pub const fn enabled(&self) -> bool {
72 self.enabled
73 }
74
75 pub const fn loaded_at(&self) -> u64 {
77 self.loaded_at
78 }
79
80 pub const fn execution_count(&self) -> u64 {
82 self.execution_count
83 }
84
85 pub const fn success_count(&self) -> u64 {
87 self.success_count
88 }
89
90 pub const fn error_count(&self) -> u64 {
92 self.error_count
93 }
94}