diff --git a/__concurrent/arc-swap/Cargo.lock b/__concurrent/arc-swap/Cargo.lock new file mode 100644 index 0000000..87e6f8c --- /dev/null +++ b/__concurrent/arc-swap/Cargo.lock @@ -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" diff --git a/__concurrent/arc-swap/Cargo.toml b/__concurrent/arc-swap/Cargo.toml new file mode 100644 index 0000000..0b2e7e4 --- /dev/null +++ b/__concurrent/arc-swap/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "arc-swap" +version = "0.1.0" +authors = ["Hatter Jiang "] +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" + + diff --git a/__concurrent/arc-swap/src/main.rs b/__concurrent/arc-swap/src/main.rs new file mode 100644 index 0000000..7ecf793 --- /dev/null +++ b/__concurrent/arc-swap/src/main.rs @@ -0,0 +1,11 @@ +use once_cell::sync::Lazy; +use arc_swap::ArcSwap; + +static TEST_STRING: Lazy> = Lazy::new(|| { + ArcSwap::from_pointee("Hello World!".to_owned()) +}); + +fn main() { + let s = TEST_STRING.load(); + println!("{}", s); +}