eryon_rt/types/
capabilities.rs1#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
8#[cfg_attr(
9 feature = "serde",
10 derive(serde_derive::Deserialize, serde_derive::Serialize)
11)]
12pub struct NodeCapabilities {
13 pub(crate) memory_usage: usize,
14 pub(crate) compute_capability: usize,
15 pub(crate) learning_capability: bool,
16 pub(crate) feature_count: usize,
17}
18
19impl NodeCapabilities {
20 pub fn new(
22 memory_usage: usize,
23 compute_capability: usize,
24 learning_capability: bool,
25 feature_count: usize,
26 ) -> Self {
27 Self {
28 compute_capability,
29 feature_count,
30 learning_capability,
31 memory_usage,
32 }
33 }
34 pub const fn compute_capability(&self) -> usize {
36 self.compute_capability
37 }
38 pub const fn compute_capability_mut(&mut self) -> &mut usize {
40 &mut self.compute_capability
41 }
42 pub const fn feature_count(&self) -> usize {
44 self.feature_count
45 }
46 pub const fn feature_count_mut(&mut self) -> &mut usize {
48 &mut self.feature_count
49 }
50 pub const fn learning_capability(&self) -> bool {
52 self.learning_capability
53 }
54 pub const fn learning_capability_mut(&mut self) -> &mut bool {
56 &mut self.learning_capability
57 }
58 pub const fn memory_usage(&self) -> usize {
60 self.memory_usage
61 }
62 pub const fn memory_usage_mut(&mut self) -> &mut usize {
64 &mut self.memory_usage
65 }
66 pub fn set_compute_capability(&mut self, compute_capability: usize) -> &mut Self {
69 self.compute_capability = compute_capability;
70 self
71 }
72 pub fn set_feature_count(&mut self, feature_count: usize) -> &mut Self {
74 self.feature_count = feature_count;
75 self
76 }
77 pub fn set_learning_capability(&mut self, learning_capability: bool) -> &mut Self {
79 self.learning_capability = learning_capability;
80 self
81 }
82 pub fn set_memory_usage(&mut self, memory_usage: usize) -> &mut Self {
84 self.memory_usage = memory_usage;
85 self
86 }
87 pub fn with_compute_capability(self, compute_capability: usize) -> Self {
89 Self {
90 compute_capability,
91 ..self
92 }
93 }
94 pub fn with_feature_count(self, feature_count: usize) -> Self {
96 Self {
97 feature_count,
98 ..self
99 }
100 }
101 pub fn with_learning_capability(self, learning_capability: bool) -> Self {
103 Self {
104 learning_capability,
105 ..self
106 }
107 }
108 pub fn with_memory_usage(self, memory_usage: usize) -> Self {
110 Self {
111 memory_usage,
112 ..self
113 }
114 }
115}