1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/// Marks static variables as region-cached.
///
/// The static variables are most conveniently used via extension methods on the
/// [`RegionCachedExt`][1] trait. Import this trait when using region-cached static variables.
///
/// # Example
///
/// ```
/// use region_cached::{RegionCachedExt, region_cached};
///
/// region_cached! {
/// static ALLOWED_KEYS: Vec<String> = vec![
/// "error".to_string(),
/// "panic".to_string()
/// ];
/// static FORBIDDEN_KEYS: Vec<String> = vec![
/// "info".to_string(),
/// "debug".to_string()
/// ];
/// }
///
/// let allowed_key_count = ALLOWED_KEYS.with_cached(|keys| keys.len());
/// ```
///
/// [1]: crate::RegionCachedExt