identifiers: Allow to set ruma_identifiers_storage cfg setting with env variable

This commit is contained in:
Kévin Commaille 2024-12-08 12:20:03 +01:00 committed by strawberry
parent 739334ac94
commit fb273553b5
5 changed files with 46 additions and 0 deletions

View File

@ -1,5 +1,14 @@
# [unreleased]
Improvements:
- The `ruma_identifiers_storage` compile-time `cfg` setting can also be
configured by setting the `RUMA_IDENTIFIERS_STORAGE` environment variable at
compile time. It has the benefit of not requiring to re-compile all the crates
of the dependency chain when the value is changed.
# 0.14.1
Bug fixes:
- The `KeyId::key_name` method now returns the key name. In 0.14.0, `key_name`

View File

@ -0,0 +1,10 @@
use std::env;
fn main() {
// Set the `ruma_identifiers_storage` configuration from an environment variable.
if let Ok(value) = env::var("RUMA_IDENTIFIERS_STORAGE") {
println!("cargo:rustc-cfg=ruma_identifiers_storage={value}");
}
println!("cargo:rerun-if-env-changed=RUMA_IDENTIFIERS_STORAGE");
}

View File

@ -3,6 +3,10 @@
Improvements:
- Add unstable support for MSC4171 for the m.member_hints state event.
- The `ruma_identifiers_storage` compile-time `cfg` setting can also be
configured by setting the `RUMA_IDENTIFIERS_STORAGE` environment variable at
compile time. It has the benefit of not requiring to re-compile all the crates
of the dependency chain when the value is changed.
Breaking changes:

View File

@ -0,0 +1,10 @@
use std::env;
fn main() {
// Set the `ruma_identifiers_storage` configuration from an environment variable.
if let Ok(value) = env::var("RUMA_IDENTIFIERS_STORAGE") {
println!("cargo:rustc-cfg=ruma_identifiers_storage={value}");
}
println!("cargo:rerun-if-env-changed=RUMA_IDENTIFIERS_STORAGE");
}

View File

@ -73,6 +73,19 @@
//!
//! If you are viewing this on `docs.rs`, you can have a look at the feature dependencies by
//! clicking **Feature flags** in the toolbar at the top.
//!
//! # Compile-time `cfg` settings
//!
//! These settings are accepted at compile time to configure the generated code. They can be set as
//! `--cfg={key}={value}` using `RUSTFLAGS` or `.cargo/config.toml` (under `[build]` -> `rustflags =
//! ["..."]`). They can also be configured using an environment variable at compile time, which has
//! the benefit of not requiring to re-compile the whole dependency chain when their value is
//! changed.
//!
//! * `ruma_identifiers_storage` -- Choose the inner representation of `Owned*` wrapper types for
//! identifiers. By default they use [`Box`], setting the value to `Arc` makes them use
//! [`Arc`](std::sync::Arc). This can also be configured by setting the `RUMA_IDENTIFIERS_STORAGE`
//! environment variable.
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]