feat: add __concurrent/arc-swap
This commit is contained in:
21
__concurrent/arc-swap/Cargo.lock
generated
Normal file
21
__concurrent/arc-swap/Cargo.lock
generated
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
[[package]]
|
||||||
|
name = "arc-swap"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"arc-swap 0.4.7",
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arc-swap"
|
||||||
|
version = "0.4.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "once_cell"
|
||||||
|
version = "1.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
|
||||||
13
__concurrent/arc-swap/Cargo.toml
Normal file
13
__concurrent/arc-swap/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "arc-swap"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
arc-swap = "0.4"
|
||||||
|
once_cell = "1.4"
|
||||||
|
|
||||||
|
|
||||||
11
__concurrent/arc-swap/src/main.rs
Normal file
11
__concurrent/arc-swap/src/main.rs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
use once_cell::sync::Lazy;
|
||||||
|
use arc_swap::ArcSwap;
|
||||||
|
|
||||||
|
static TEST_STRING: Lazy<ArcSwap<String>> = Lazy::new(|| {
|
||||||
|
ArcSwap::from_pointee("Hello World!".to_owned())
|
||||||
|
});
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let s = TEST_STRING.load();
|
||||||
|
println!("{}", s);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user