From a8927135e8023b4cd5e5c33eb934e46184f19e4d Mon Sep 17 00:00:00 2001 From: Andri Reveli Date: Sat, 25 Sep 2021 10:02:20 +0200 Subject: [PATCH] fix formatting --- src/std/arc.md | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/std/arc.md b/src/std/arc.md index d36ca0802a..08d1ad31aa 100644 --- a/src/std/arc.md +++ b/src/std/arc.md @@ -3,25 +3,24 @@ When shared ownership between threads is needed, `Arc`(Atomic Reference Counted) can be used. This struct, via the `Clone` implementation can create a reference pointer for the location of a value in the memory heap while increasing the reference counter. As it shares ownership between threads, when the last reference pointer to a value is out of scope, the variable is dropped. ```rust,editable - -fn main() { use std::sync::Arc; use std::thread; -// This variable declaration is where its value is specified. -let apple = Arc::new("the same apple"); +fn main() { + // This variable declaration is where its value is specified. + let apple = Arc::new("the same apple"); -for _ in 0..10 { - // Here there is no value specification as it is a pointer to a reference - // in the memory heap. - let apple = Arc::clone(&apple); + for _ in 0..10 { + // Here there is no value specification as it is a pointer to a reference + // in the memory heap. + let apple = Arc::clone(&apple); - thread::spawn(move || { - // As Arc was used, threads can be spawned using the value allocated - // in the Arc variable pointer's location. - println!("{:?}", apple); - }); -} + thread::spawn(move || { + // As Arc was used, threads can be spawned using the value allocated + // in the Arc variable pointer's location. + println!("{:?}", apple); + }); + } } ```