feat: add __concurrent/arc-swap

This commit is contained in:
2020-11-04 01:04:22 +08:00
parent 5c9a439fe1
commit 9c8c467fea
3 changed files with 45 additions and 0 deletions

21
__concurrent/arc-swap/Cargo.lock generated Normal file
View 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"

View 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"

View 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);
}