diff --git a/lang/rust/avro/Cargo.toml b/lang/rust/avro/Cargo.toml index be547acca91..15a9eb980af 100644 --- a/lang/rust/avro/Cargo.toml +++ b/lang/rust/avro/Cargo.toml @@ -69,7 +69,7 @@ strum = "0.24.0" strum_macros = "0.24.0" thiserror = "1.0.30" typed-builder = "0.10.0" -uuid = { version = "0.8.2", features = ["serde", "v4"] } +uuid = { version = "1.0.0", features = ["serde", "v4"] } zerocopy = "0.6.1" lazy_static = "1.4.0" log = "0.4.16" diff --git a/lang/rust/avro/src/encode.rs b/lang/rust/avro/src/encode.rs index 04d220276b3..7af2c6976e8 100644 --- a/lang/rust/avro/src/encode.rs +++ b/lang/rust/avro/src/encode.rs @@ -101,7 +101,13 @@ pub(crate) fn encode_internal( let slice: [u8; 12] = duration.into(); buffer.extend_from_slice(&slice); } - Value::Uuid(uuid) => encode_bytes(&uuid.to_string(), buffer), + Value::Uuid(uuid) => encode_bytes( + #[allow(unknown_lints)] // for Rust 1.51.0 + #[allow(clippy::unnecessary_to_owned)] + // we need the call .to_string() to properly convert ASCII to UTF-8 + &uuid.to_string(), + buffer, + ), Value::Bytes(bytes) => match *schema { Schema::Bytes => encode_bytes(bytes, buffer), Schema::Fixed { .. } => buffer.extend(bytes), diff --git a/lang/rust/avro/src/lib.rs b/lang/rust/avro/src/lib.rs index 8b271d60337..539707cd7aa 100644 --- a/lang/rust/avro/src/lib.rs +++ b/lang/rust/avro/src/lib.rs @@ -512,7 +512,7 @@ //! `apache-avro` also supports the logical types listed in the [Avro specification](https://avro.apache.org/docs/current/spec.html#Logical+Types): //! //! 1. `Decimal` using the [`num_bigint`](https://docs.rs/num-bigint/0.2.6/num_bigint) crate -//! 1. UUID using the [`uuid`](https://docs.rs/uuid/0.8.1/uuid) crate +//! 1. UUID using the [`uuid`](https://docs.rs/uuid/1.0.0/uuid) crate //! 1. Date, Time (milli) as `i32` and Time (micro) as `i64` //! 1. Timestamp (milli and micro) as `i64` //! 1. Duration as a custom type with `months`, `days` and `millis` accessor methods each of which returns an `i32` diff --git a/lang/rust/avro/src/types.rs b/lang/rust/avro/src/types.rs index 2ecb23e0ac8..89d66facaff 100644 --- a/lang/rust/avro/src/types.rs +++ b/lang/rust/avro/src/types.rs @@ -327,7 +327,7 @@ impl std::convert::TryFrom for JsonValue { Value::Duration(d) => Ok(Self::Array( <[u8; 12]>::from(d).iter().map(|&v| v.into()).collect(), )), - Value::Uuid(uuid) => Ok(Self::String(uuid.to_hyphenated().to_string())), + Value::Uuid(uuid) => Ok(Self::String(uuid.as_hyphenated().to_string())), } } }