-
Rust❤️1.63 아주 기대가 많이 되는 3가지 기능코딩Coding/Rust☑︎Release☀︎Notes_New◎Version 2022. 7. 10. 22:48728x90
1.63 아주 기대가 많이 됩니다.
1:static X: Mutex<String> = Mutex::new(String::new()); [Global variable 최고
/ 2: *X.lock().unwrap() = "Important information".to_string()
/ (오늘)3: Scoped threads 감사합니다. 언제나 최고
1:static X: Mutex<String> = Mutex::new(String::new()); [Global variable 최고 & / 2: *X.lock().unwrap() = "Important information".to_string()
https://youtu.be/T5OwV2HaH9E
Scoped threads
3. https://youtu.be/FfZJd-bpGdc
러스트 1.63 beta version 코드 입니다.
// rust 1.63 beta code ___ use std::sync::Mutex; use std::thread; fn main() { let mut a = vec![1, 2, 3]; let mut x = 0; thread::scope(|s| { s.spawn(|| { println!("Hello from the first scoped thread"); // We can borrow `a` here. dbg!(&a); }); s.spawn(|| { println!("Hello from the first scoped thread"); // We can even butably borrow `x` here, // because no other threads are using it. x += a[0] + a[2]; }); println!("hello from the main thread"); }); // After the scope, we can modify and access our vatiables again: a.push(4); println!("print x : {}", a.len()); }
결과
Hello from the first scoped thread Hello from the first scoped thread [src/main.rs:13] &a = [ 1, 2, 3, ] hello from the main thread print x : 4
https://twitter.com/m_ou_se/status/1538234055329718273?s=20&t=DRiTVzqhQ5Hz8fkpTMxnmg
반응형'코딩Coding > Rust☑︎Release☀︎Notes_New◎Version' 카테고리의 다른 글
1.63에 적용된 f64내용 (0) 2022.08.17 Rust 1.63.0 Released 획기적인 업데이트 내용 16 가지 (0) 2022.08.12 Rust❤️Rustup 1.25.0 released (0) 2022.07.12 Rust 1.62❤️에서 최적화 된 std::sync::Mutex, RwLock, 겁나게 빨라짐. (0) 2022.07.11 RLS Deprecation | Rust Blog - 결국은 rust analyst 가 win❤️ 역시 강한 놈만 살아 남는다 ㅋ (0) 2022.07.02 Announcing Rust 1.62.0__❤️How does the new Mutex implementation compare to parking_lot? (0) 2022.07.01 Rust 1.61.0 ❤️__<[T]>::as_mut_ptr_range (0) 2022.06.29 Rust 2021 edition❤️에서는 Rust 2018 edition에서 써 온 extern crate란 문법을 쓰지 않아요❤️ (0) 2022.06.27