Skip to content

Commit

Permalink
chore: update prost to 0.12 (#111)
Browse files Browse the repository at this point in the history
* chore: update prost to 0.12

* chore: fix lint

* chore: update descriptors

---------

Co-authored-by: Raphael Taylor-Davies <[email protected]>
  • Loading branch information
jeffreyssmith2nd and tustvold authored Sep 17, 2023
1 parent 768c324 commit 0854380
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[workspace]
members = [
"pbjson",
"pbjson-build",
"pbjson-test",
"pbjson-types",
"pbjson",
"pbjson-build",
"pbjson-test",
"pbjson-types",
]

resolver = "2"
4 changes: 2 additions & 2 deletions pbjson-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ repository = "https://github.com/influxdata/pbjson"

[dependencies]
heck = "0.4"
prost = "0.11"
prost-types = "0.11"
prost = "0.12"
prost-types = "0.12"
itertools = "0.10"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions pbjson-build/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ fn field_modifier(
field: &FieldDescriptorProto,
field_type: &FieldType,
) -> FieldModifier {
let label = Label::from_i32(field.label.expect("expected label")).expect("valid label");
let label = Label::try_from(field.label.expect("expected label")).expect("valid label");
if field.proto3_optional.unwrap_or(false) {
assert_eq!(label, Label::Optional);
return FieldModifier::Optional;
Expand Down Expand Up @@ -217,7 +217,7 @@ fn field_type(descriptors: &DescriptorSet, field: &FieldDescriptorProto) -> Fiel
Some(type_name) => resolve_type(descriptors, type_name.as_str()),
None => {
let scalar =
match Type::from_i32(field.r#type.expect("expected type")).expect("valid type") {
match Type::try_from(field.r#type.expect("expected type")).expect("valid type") {
Type::Double => ScalarType::F64,
Type::Float => ScalarType::F32,
Type::Int64 | Type::Sfixed64 | Type::Sint64 => ScalarType::I64,
Expand Down
4 changes: 2 additions & 2 deletions pbjson-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "Test resources for pbjson converion"
repository = "https://github.com/influxdata/pbjson"

[dependencies]
prost = "0.11"
prost = "0.12"
pbjson = { path = "../pbjson" }
pbjson-types = { path = "../pbjson-types" }
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -24,5 +24,5 @@ chrono = "0.4"
serde_json = "1.0"

[build-dependencies]
prost-build = "0.11"
prost-build = "0.12"
pbjson-build = { path = "../pbjson-build" }
4 changes: 2 additions & 2 deletions pbjson-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ exclude = ["protos/*"]
bytes = "1.0"
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
pbjson = { path = "../pbjson", version = "0.5" }
prost = "0.11"
prost = "0.12"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
serde_json = "1.0"

[build-dependencies] # In alphabetical order
prost-build = "0.11"
prost-build = "0.12"
pbjson-build = { path = "../pbjson-build", version = "0.5" }
Binary file modified pbjson-types/descriptors.bin
Binary file not shown.
6 changes: 3 additions & 3 deletions pbjson-types/src/timestamp.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::Timestamp;
use chrono::{DateTime, NaiveDateTime, Utc};
use chrono::{DateTime, NaiveDateTime, TimeZone, Utc};
use serde::de::Visitor;
use serde::Serialize;

impl TryFrom<Timestamp> for chrono::DateTime<Utc> {
impl TryFrom<Timestamp> for DateTime<Utc> {
type Error = &'static str;
fn try_from(value: Timestamp) -> Result<Self, Self::Error> {
let Timestamp { seconds, nanos } = value;
Expand All @@ -15,7 +15,7 @@ impl TryFrom<Timestamp> for chrono::DateTime<Utc> {
.map_err(|_| "out of range integral type conversion attempted")?,
)
.ok_or("invalid or out-of-range datetime")?;
Ok(Self::from_utc(dt, Utc))
Ok(Utc.from_utc_datetime(&dt))
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.71"
channel = "1.72"
components = ["rustfmt", "clippy"]

0 comments on commit 0854380

Please sign in to comment.