Skip to content

Commit 09783b2

Browse files
authored
Merge pull request #314 from adrianreber/2024-12-17-protobuf
Upgrade to protobuf 3.7.1
2 parents b87cb0c + 9524075 commit 09783b2

File tree

10 files changed

+278
-219
lines changed

10 files changed

+278
-219
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727

2828
steps:
2929
- uses: actions/checkout@v3
30+
- name: Install dependencies
31+
run: sudo apt-get install -y protobuf-compiler
3032
- name: Build
3133
run: cargo build --verbose
3234
- name: Run clippy

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ hyper = { version = "0.14", features = ["server", "http1", "http2", "runtime"] }
1212
log = "0.4"
1313
pretty_env_logger = "0.5"
1414
chrono = "0.4"
15-
protobuf = "2.14.0"
16-
url = "2.5.2"
15+
protobuf = "3.7.1"
16+
url = "2.3.1"
1717
regex = "1"
1818
ipnet = "2.9.0"
1919
treebitmap = "0.4.0"
@@ -35,7 +35,7 @@ version = "1.29.1"
3535
features = ["macros", "rt-multi-thread"]
3636

3737
[build-dependencies]
38-
protobuf-codegen-pure = "2.14.0"
38+
protobuf-codegen = "3.7.1"
3939

4040
[dev-dependencies]
4141
tempfile = "3.10.1"

build.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
extern crate protobuf_codegen_pure;
1+
extern crate protobuf_codegen;
22

33
fn main() {
4-
protobuf_codegen_pure::Codegen::new()
4+
protobuf_codegen::Codegen::new()
55
.out_dir("src/bin/common/protos")
66
.inputs(["protos/mirrormanager.proto"])
77
.include("protos")
8-
.run()
9-
.expect("Codegen failed.");
8+
.run_from_script();
109
}

src/bin/common/functions.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn find_in_file_details_cache_directory_cache(
99
dir: &str,
1010
) -> i64 {
1111
for (index, e) in fdcdc.iter().enumerate() {
12-
if e.get_directory() == dir {
12+
if e.directory() == dir {
1313
return index as i64;
1414
}
1515
}
@@ -18,7 +18,7 @@ pub fn find_in_file_details_cache_directory_cache(
1818

1919
pub fn find_in_mirrorlist_cache(mlc: &[MirrorListCacheType], dir: &str) -> i64 {
2020
for (index, mirrorlist_cache) in mlc.iter().enumerate() {
21-
if mirrorlist_cache.get_directory() == dir {
21+
if mirrorlist_cache.directory() == dir {
2222
return index as i64;
2323
}
2424
}
@@ -28,43 +28,43 @@ pub fn find_in_mirrorlist_cache(mlc: &[MirrorListCacheType], dir: &str) -> i64 {
2828
pub fn find_in_string_string_map(ssm: &[StringStringMap], key: &str) -> String {
2929
let mut result = String::new();
3030
for param in ssm {
31-
if param.get_key() == key {
32-
result.push_str(param.get_value());
31+
if param.key() == key {
32+
result.push_str(param.value());
3333
}
3434
}
3535
result
3636
}
3737

3838
pub fn find_in_string_bool_map(sbm: &[StringBoolMap], key: &str) -> bool {
3939
for param in sbm {
40-
if param.get_key() == key {
41-
return param.get_value();
40+
if param.key() == key {
41+
return param.value();
4242
}
4343
}
4444
false
4545
}
4646

4747
pub fn find_in_int_int_map(iim: &[IntIntMap], key: i64) -> i64 {
4848
for e in iim {
49-
if e.get_key() == key {
50-
return e.get_value();
49+
if e.key() == key {
50+
return e.value();
5151
}
5252
}
5353
0
5454
}
5555

5656
pub fn find_in_int_string_map(ism: &[IntStringMap], key: i64) -> String {
5757
for e in ism {
58-
if e.get_key() == key {
59-
return String::from(e.get_value());
58+
if e.key() == key {
59+
return String::from(e.value());
6060
}
6161
}
6262
String::new()
6363
}
6464

6565
pub fn find_in_int_repeated_string_map(irsm: &[IntRepeatedStringMap], key: i64) -> i64 {
6666
for (index, param) in irsm.iter().enumerate() {
67-
if param.get_key() == key {
67+
if param.key() == key {
6868
return index as i64;
6969
}
7070
}
@@ -73,7 +73,7 @@ pub fn find_in_int_repeated_string_map(irsm: &[IntRepeatedStringMap], key: i64)
7373

7474
pub fn find_in_int_repeated_int_map(irim: &[IntRepeatedIntMap], key: i64) -> i64 {
7575
for (index, param) in irim.iter().enumerate() {
76-
if param.get_key() == key {
76+
if param.key() == key {
7777
return index as i64;
7878
}
7979
}
@@ -82,7 +82,7 @@ pub fn find_in_int_repeated_int_map(irim: &[IntRepeatedIntMap], key: i64) -> i64
8282

8383
pub fn find_in_string_repeated_int_map(irim: &[StringRepeatedIntMap], key: &str) -> i64 {
8484
for (index, param) in irim.iter().enumerate() {
85-
if param.get_key() == key {
85+
if param.key() == key {
8686
return index as i64;
8787
}
8888
}
@@ -94,7 +94,7 @@ pub fn find_in_file_details_cache_files_cache(
9494
file: &str,
9595
) -> i64 {
9696
for (index, e) in fdcfc.iter().enumerate() {
97-
if e.get_filename() == file {
97+
if e.filename() == file {
9898
return index as i64;
9999
}
100100
}

src/bin/common/protos/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
// @generated
2+
13
pub mod mirrormanager;

0 commit comments

Comments
 (0)