Skip to content

Commit 10b5e2e

Browse files
Merge pull request #93 from code0-tech/tucana-0-0-43
dependencies: updated to latest tucana version
2 parents e010490 + 8c128e1 commit 10b5e2e

File tree

4 files changed

+14
-39
lines changed

4 files changed

+14
-39
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ homepage = "https://code0.tech"
88
license = "Apache-2.0"
99

1010
[dependencies]
11-
tucana = { version = "0.0.42", features = ["aquila"] }
11+
tucana = { version = "0.0.43", features = ["aquila"] }
1212
async-trait = "0.1.85"
1313
log = "0.4.24"
1414
tonic = "0.14.1"
Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,29 @@
1-
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition, Version};
1+
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition};
22

33
pub trait HasVersion {
4-
fn version(&self) -> &Option<Version>;
5-
fn version_mut(&mut self) -> &mut Option<Version>;
4+
fn version(&self) -> &String;
65

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 {
167
filter
178
.as_ref()
18-
.is_none_or(|v| self.version().as_ref() == Some(v))
9+
.is_none_or(|v| self.version() == v)
1910
}
2011
}
2112

2213
impl HasVersion for DefinitionDataType {
23-
fn version(&self) -> &Option<Version> {
14+
fn version(&self) -> &String {
2415
&self.version
2516
}
26-
27-
fn version_mut(&mut self) -> &mut Option<Version> {
28-
&mut self.version
29-
}
3017
}
3118

3219
impl HasVersion for FlowType {
33-
fn version(&self) -> &Option<Version> {
20+
fn version(&self) -> &String {
3421
&self.version
3522
}
36-
37-
fn version_mut(&mut self) -> &mut Option<Version> {
38-
&mut self.version
39-
}
4023
}
4124

4225
impl HasVersion for RuntimeFunctionDefinition {
43-
fn version(&self) -> &Option<Version> {
26+
fn version(&self) -> &String {
4427
&self.version
4528
}
46-
47-
fn version_mut(&mut self) -> &mut Option<Version> {
48-
&mut self.version
49-
}
5029
}

src/flow_definition/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ mod feature;
33

44
use crate::flow_definition::error::ReaderError;
55
use crate::flow_definition::feature::Feature;
6-
use crate::flow_definition::feature::version::HasVersion;
76
use serde::de::DeserializeOwned;
87
use std::fs;
98
use std::path::Path;
10-
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition, Version};
9+
use tucana::shared::{DefinitionDataType, FlowType, RuntimeFunctionDefinition};
1110
use walkdir::WalkDir;
11+
use crate::flow_definition::feature::version::HasVersion;
1212

1313
pub struct Reader {
1414
should_break: bool,
1515
accepted_features: Vec<String>,
16-
accepted_version: Option<Version>,
16+
accepted_version: Option<String>,
1717
path: String,
1818
}
1919

@@ -22,7 +22,7 @@ impl Reader {
2222
path: String,
2323
should_break: bool,
2424
accepted_features: Vec<String>,
25-
accepted_version: Option<Version>,
25+
accepted_version: Option<String>,
2626
) -> Self {
2727
Self {
2828
should_break,
@@ -180,10 +180,6 @@ impl Reader {
180180

181181
let items = raw
182182
.into_iter()
183-
.map(|mut v| {
184-
v.normalize_version();
185-
v
186-
})
187183
.filter(|v| v.is_accepted(&self.accepted_version))
188184
.collect();
189185

0 commit comments

Comments
 (0)