diff --git a/Cargo.toml b/Cargo.toml index b13ec79..6797e52 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,9 @@ [workspace] members = [ - "pbjson", - "pbjson-build", - "pbjson-test", - "pbjson-types", + "pbjson", + "pbjson-build", + "pbjson-test", + "pbjson-types", ] + +resolver = "2" \ No newline at end of file diff --git a/pbjson-build/Cargo.toml b/pbjson-build/Cargo.toml index 5774a66..153eb80 100644 --- a/pbjson-build/Cargo.toml +++ b/pbjson-build/Cargo.toml @@ -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] diff --git a/pbjson-build/src/message.rs b/pbjson-build/src/message.rs index 4364fca..8153153 100644 --- a/pbjson-build/src/message.rs +++ b/pbjson-build/src/message.rs @@ -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; @@ -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, diff --git a/pbjson-test/Cargo.toml b/pbjson-test/Cargo.toml index 5b7fb55..f1c6b5f 100644 --- a/pbjson-test/Cargo.toml +++ b/pbjson-test/Cargo.toml @@ -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"] } @@ -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" } diff --git a/pbjson-types/Cargo.toml b/pbjson-types/Cargo.toml index 570639b..ba3c917 100644 --- a/pbjson-types/Cargo.toml +++ b/pbjson-types/Cargo.toml @@ -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" } diff --git a/pbjson-types/descriptors.bin b/pbjson-types/descriptors.bin index b7fe631..0e370ea 100644 Binary files a/pbjson-types/descriptors.bin and b/pbjson-types/descriptors.bin differ diff --git a/pbjson-types/src/timestamp.rs b/pbjson-types/src/timestamp.rs index 1722a9a..e7a1fc5 100644 --- a/pbjson-types/src/timestamp.rs +++ b/pbjson-types/src/timestamp.rs @@ -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 for chrono::DateTime { +impl TryFrom for DateTime { type Error = &'static str; fn try_from(value: Timestamp) -> Result { let Timestamp { seconds, nanos } = value; @@ -15,7 +15,7 @@ impl TryFrom for chrono::DateTime { .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)) } } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7b7e745..e724aeb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.71" +channel = "1.72" components = ["rustfmt", "clippy"]