Comprehensive Rust(繁体中文)63.1 async/await . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 63.2 Futures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328 63.3 Runtimes . 作了事件迴圈(event loop),所以隱藏了很多關於 Promise 的處理細節。 63.1 async/await 從高層次的角度來看,非同步的 Rust 程式碼看起來很像「一般的」同步程式碼: use futures::executor::block_on; async fn count_to(count: i32) { for i in 1..=count { println!("Count is: • .await can only be used inside an async function (or block; these are introduced later). 63.2 Futures Future 是一種特徵,物件實作這種特徵時,代表作業或許尚未完成。Future 可供輪詢,而 poll 會傳回 Poll。 use std::pin::Pin; use std::task::Context;0 码力 | 358 页 | 1.41 MB | 10 月前3
julia 1.10.10second line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. @async is similar to @spawnat, but only runs process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.10.9second line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. @async is similar to @spawnat, but only runs process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.11.4second line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. @async is similar to @spawnat, but only runs process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 Documentationsecond line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. @async is similar to @spawnat, but only runs process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release Notessecond line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. @async is similar to @spawnat, but only runs process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.13.0 DEVsecond line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. Threads.@spawn is similar to @spawnat, but only process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 2058 页 | 7.45 MB | 3 月前3
Julia 1.12.0 RC1second line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. Threads.@spawn is similar to @spawnat, but only process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta4second line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. Threads.@spawn is similar to @spawnat, but only process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta3second line we asked it to add 1 to it. The result of both calculations is available in the two futures, r and s. The @spawnat macro evaluates the expression in the second argument on the process specified cache its value locally. Further fetch calls do not entail a network hop. Once all referencing Futures have fetched, the remote stored value is deleted. Threads.@spawn is similar to @spawnat, but only process and a "delete reference" message when a reference is locally garbage collected. Since Futures are write-once and cached locally, the act of fetching a Future also updates reference tracking0 码力 | 2057 页 | 7.44 MB | 3 月前3
共 11 条
- 1
- 2













