1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-02-23 02:43:16 +01:00

Remove --cfg uuid_unstable requirement for uuid_v7 feature (#123)

This commit is contained in:
Sanchith Hegde 2024-03-10 22:29:48 +05:30 committed by GitHub
parent c173c386de
commit 89363c538d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1 additions and 15 deletions

View File

@ -82,9 +82,6 @@ jobs:
test_uuid_v7: test_uuid_v7:
name: Test name: Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
RUSTFLAGS: "--cfg uuid_unstable"
RUSTDOCFLAGS: "--cfg uuid_unstable"
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Cache dependencies - name: Cache dependencies

View File

@ -290,8 +290,6 @@ If you need to **trace** a request across multiple services (e.g. in a microserv
Optionally, using the `uuid_v7` feature flag will allow [`RequestId`] to use UUID v7 instead of the currently used UUID v4. Optionally, using the `uuid_v7` feature flag will allow [`RequestId`] to use UUID v7 instead of the currently used UUID v4.
However, the [`uuid`] crate requires a compile time flag `uuid_unstable` to be passed in `RUSTFLAGS="--cfg uuid_unstable"` in order to compile. You can read more about it [here](https://docs.rs/uuid/latest/uuid/#unstable-features).
## Trace Id ## Trace Id
To fulfill a request you often have to perform additional I/O operations - e.g. calls to other REST or gRPC APIs, database queries, etc. To fulfill a request you often have to perform additional I/O operations - e.g. calls to other REST or gRPC APIs, database queries, etc.

View File

@ -259,8 +259,6 @@
//! //!
//! Optionally, using the `uuid_v7` feature flag will allow [`RequestId`] to use UUID v7 instead of the currently used UUID v4. //! Optionally, using the `uuid_v7` feature flag will allow [`RequestId`] to use UUID v7 instead of the currently used UUID v4.
//! //!
//! However, the [`uuid`] crate requires a compile time flag `uuid_unstable` to be passed in `RUSTFLAGS="--cfg uuid_unstable"` in order to compile. You can read more about it [here](https://docs.rs/uuid/latest/uuid/#unstable-features).
//!
//! ## Trace Id //! ## Trace Id
//! //!
//! To fulfill a request you often have to perform additional I/O operations - e.g. calls to other REST or gRPC APIs, database queries, etc. //! To fulfill a request you often have to perform additional I/O operations - e.g. calls to other REST or gRPC APIs, database queries, etc.

View File

@ -27,23 +27,16 @@ use uuid::Uuid;
/// ``` /// ```
/// ///
/// Optionally, using the `uuid_v7` feature flag will allow [`RequestId`] to use UUID v7 instead of the currently used UUID v4. /// Optionally, using the `uuid_v7` feature flag will allow [`RequestId`] to use UUID v7 instead of the currently used UUID v4.
///
/// However, the [`uuid`] crate requires a compile time flag `uuid_unstable` to be passed in `RUSTFLAGS="--cfg uuid_unstable"` in order to compile. You can read more about it [here](https://docs.rs/uuid/latest/uuid/#unstable-features).
///
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct RequestId(Uuid); pub struct RequestId(Uuid);
impl RequestId { impl RequestId {
pub(crate) fn generate() -> Self { pub(crate) fn generate() -> Self {
// Compiler error for providing context on requirements to enable the `uuid_v7` feature flag
#[cfg(all(feature = "uuid_v7", not(uuid_unstable)))]
compile_error!("feature \"uuid_v7\" requires \"uuid_unstable\" to be passed as configuration in rustflags");
#[cfg(not(feature = "uuid_v7"))] #[cfg(not(feature = "uuid_v7"))]
{ {
Self(Uuid::new_v4()) Self(Uuid::new_v4())
} }
#[cfg(all(uuid_unstable, feature = "uuid_v7"))] #[cfg(feature = "uuid_v7")]
{ {
Self(Uuid::now_v7()) Self(Uuid::now_v7())
} }