-
Rust Futures❤️에 대해 공부하기_Concurrency기초코딩Coding/한글Rust강의★내가★공부하려고만듬 2022. 6. 11. 17:54728x90
https://cfsamson.github.io/books-futures-explained/0_background_information.html
Background information - Futures Explained in 200 Lines of Rust
Before we go into the details about Futures in Rust, let's take a quick look at the alternatives for handling concurrent programming in general and some pros and cons for each of them. While we do that we'll also explain some aspects when it comes to concu
cfsamson.github.io
https://rust-lang.github.io/async-book/02_execution/02_future.html
The Future Trait - Asynchronous Programming in Rust
The Future trait is at the center of asynchronous programming in Rust. A Future is an asynchronous computation that can produce a value (although that value may be empty, e.g. ()). A simplified version of the future trait might look something like this: #!
rust-lang.github.io
Futures구현 참고
trait Futures { type Output; fn poll(&mut self, wake: fn()) -> Poll<Self::Output>; } impl<T> Poll<T> { pub fn map<U, F>(self, f: F) -> Poll<U> where F: FnOnce(T) -> U, { match self { Poll::Ready(t) => Poll::Ready(f(t)), Poll::Pending => Poll::Pending, } } } enum Poll<T> { Ready(T), Pending, } fn my_function() /* -> impl Futures<Output = ()>*/ { println!("I'm an async function!"); } fn main() { my_function(); }
이 영상과
https://rust-lang.github.io/async-book/02_execution/02_future.html
The Future Trait - Asynchronous Programming in Rust
The Future trait is at the center of asynchronous programming in Rust. A Future is an asynchronous computation that can produce a value (although that value may be empty, e.g. ()). A simplified version of the future trait might look something like this: #!
rust-lang.github.io
https://docs.rs/tokio/1.19.2/tokio/sync/index.html
tokio::sync - Rust
Available on crate feature sync only.Expand descriptionSynchronization primitives for use in asynchronous contexts. Tokio programs tend to be organized as a set of tasks where each task operates independently and may be executed on separate physical thread
docs.rs
반응형'코딩Coding > 한글Rust강의★내가★공부하려고만듬' 카테고리의 다른 글
Rust❤️ ] rayon을 활용한 벡터에 이쁘게 숫자 차례대로 담기 (0) 2022.06.14 Rust❤️ 벡터에 Vector내가 원하는 숫자 원하는 크기만큼 랜덤 숫자 담기 ^^; (0) 2022.06.13 동영상만들예정❤️Rust❤️wgpu__3D게임 Tutorial연습용 코드로 딱 좋다!_rayon상급자 버젼 ㅎㅎㅎ (0) 2022.06.12 Rust vs Cpp ❤️threads 한글 강의 (0) 2022.06.11 Rust❤️Bevy_Game기초 동영상 만들 예정❤️ (0) 2022.06.11 Rust❤️Bubble sort와 Timsort & PDQSort 성능 비교 예정 (0) 2022.06.10 rust❤️) 기차 모양 프린트 & multithread연습 + C++과 비교해서 연습 (0) 2022.06.10 Rust❤️byExample한글 버젼 full tutorial❤️로 동영상 만들 예정 (0) 2022.06.08