|
1 | | -use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition, Version}; |
| 1 | +use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition}; |
2 | 2 |
|
3 | 3 | pub trait HasVersion { |
4 | | - fn version(&self) -> &Option<Version>; |
5 | | - fn version_mut(&mut self) -> &mut Option<Version>; |
| 4 | + fn version(&self) -> &String; |
6 | 5 |
|
7 | | - fn normalize_version(&mut self) { |
8 | | - self.version_mut().get_or_insert(Version { |
9 | | - major: 0, |
10 | | - minor: 0, |
11 | | - patch: 0, |
12 | | - }); |
13 | | - } |
14 | | - |
15 | | - fn is_accepted(&self, filter: &Option<Version>) -> bool { |
| 6 | + fn is_accepted(&self, filter: &Option<String>) -> bool { |
16 | 7 | filter |
17 | 8 | .as_ref() |
18 | | - .is_none_or(|v| self.version().as_ref() == Some(v)) |
| 9 | + .is_none_or(|v| self.version() == v) |
19 | 10 | } |
20 | 11 | } |
21 | 12 |
|
22 | 13 | impl HasVersion for DefinitionDataType { |
23 | | - fn version(&self) -> &Option<Version> { |
| 14 | + fn version(&self) -> &String { |
24 | 15 | &self.version |
25 | 16 | } |
26 | | - |
27 | | - fn version_mut(&mut self) -> &mut Option<Version> { |
28 | | - &mut self.version |
29 | | - } |
30 | 17 | } |
31 | 18 |
|
32 | 19 | impl HasVersion for FlowType { |
33 | | - fn version(&self) -> &Option<Version> { |
| 20 | + fn version(&self) -> &String { |
34 | 21 | &self.version |
35 | 22 | } |
36 | | - |
37 | | - fn version_mut(&mut self) -> &mut Option<Version> { |
38 | | - &mut self.version |
39 | | - } |
40 | 23 | } |
41 | 24 |
|
42 | 25 | impl HasVersion for RuntimeFunctionDefinition { |
43 | | - fn version(&self) -> &Option<Version> { |
| 26 | + fn version(&self) -> &String { |
44 | 27 | &self.version |
45 | 28 | } |
46 | | - |
47 | | - fn version_mut(&mut self) -> &mut Option<Version> { |
48 | | - &mut self.version |
49 | | - } |
50 | 29 | } |
0 commit comments