mirror of
https://github.com/actix/actix-extras.git
synced 2025-02-22 18:33:18 +01:00
Remove --cfg uuid_unstable
requirement for uuid_v7
feature (#123)
This commit is contained in:
parent
c173c386de
commit
89363c538d
3
.github/workflows/general.yml
vendored
3
.github/workflows/general.yml
vendored
@ -82,9 +82,6 @@ jobs:
|
||||
test_uuid_v7:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RUSTFLAGS: "--cfg uuid_unstable"
|
||||
RUSTDOCFLAGS: "--cfg uuid_unstable"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache dependencies
|
||||
|
@ -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.
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
@ -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.
|
||||
//!
|
||||
//! 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
|
||||
//!
|
||||
//! 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.
|
||||
|
@ -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.
|
||||
///
|
||||
/// 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)]
|
||||
pub struct RequestId(Uuid);
|
||||
|
||||
impl RequestId {
|
||||
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"))]
|
||||
{
|
||||
Self(Uuid::new_v4())
|
||||
}
|
||||
#[cfg(all(uuid_unstable, feature = "uuid_v7"))]
|
||||
#[cfg(feature = "uuid_v7")]
|
||||
{
|
||||
Self(Uuid::now_v7())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user