You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/04/21 18:14:08 UTC
[avro] branch branch-1.11 updated: Update uuid requirement from 0.8.2 to 1.0.0 in /lang/rust (#1660)
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/branch-1.11 by this push:
new 420716030 Update uuid requirement from 0.8.2 to 1.0.0 in /lang/rust (#1660)
420716030 is described below
commit 420716030c8ceeb40ab218ad10d4f84865044ea0
Author: dependabot[bot] <49...@users.noreply.github.com>
AuthorDate: Thu Apr 21 21:13:27 2022 +0300
Update uuid requirement from 0.8.2 to 1.0.0 in /lang/rust (#1660)
* Update uuid requirement from 0.8.2 to 1.0.0 in /lang/rust
Updates the requirements on [uuid](https://github.com/uuid-rs/uuid) to permit the latest version.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/0.8.2...1.0.0)
---
updated-dependencies:
- dependency-name: uuid
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <su...@github.com>
* Issue #1660 - Fix compilation errors after updating uuid crate from 0.8 to 1.0
Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
Co-authored-by: Martin Tzvetanov Grigorov <mg...@apache.org>
(cherry picked from commit d16410a651c7cf6dd7b991d6bf91709fe016f937)
---
lang/rust/avro/Cargo.toml | 2 +-
lang/rust/avro/src/encode.rs | 8 +++++++-
lang/rust/avro/src/lib.rs | 2 +-
lang/rust/avro/src/types.rs | 2 +-
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/lang/rust/avro/Cargo.toml b/lang/rust/avro/Cargo.toml
index be547acca..15a9eb980 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 04d220276..7af2c6976 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 8b271d603..539707cd7 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 2ecb23e0a..89d66faca 100644
--- a/lang/rust/avro/src/types.rs
+++ b/lang/rust/avro/src/types.rs
@@ -327,7 +327,7 @@ impl std::convert::TryFrom<Value> 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())),
}
}
}