How Meta Made Debugging Async Code Easier with Coroutines and Senders
… … Stack Traces for Async Code are Unhelpful Threadpool threads: #0 process_file(...) #5 pool.run() #10 __clone … … IO Thread: #0 async_read_some_at(...) #3 ctx Threadpool threads: #0 process_file(...) #5 pool.run() #10 … IO Thread: … #0 async_read_some_at(...) #3 ctx.run() #5 __clone … … Main thread: #0 unifex::sync_wait( … #0 async_read_some_at(...) … #12 unifex::sync_wait(...) #16 main() #19 __libc_start_main() … … Async Stacks are BetterStructured Concurrency Makes Async Stacks Possible0 码力 | 131 页 | 907.41 KB | 5 月前3C++/Rust Interop: Using Bridges in Practice
1 - New Rust Extends a C++ Project 5Large existing C++ Library New Plugin Existing Plugins 6C++ Header Class with Methods C++ Source Uses extern “C” from Rust Unsafe Rust C ABI Safe Rust hpp cpp std::unique_ptr<rust::Joint, deleter_from_fn> robot_joint_; }; } // namespace robot_joint hpp 10namespace robot_joint::rust { struct Joint; } // namespace robot_joint::rust extern "C" "C" { extern void robot_joint_free(robot_joint::rust::Joint*); } template struct deleter_from_fn { template constexpr void operator()(T* arg) const { fn(arg); } }; hpp 0 码力 | 45 页 | 724.12 KB | 5 月前3Rust 程序设计语言 简体中文版 1.85.0
Rust 程序设计语言 简体中文版Rust 程序设计语言 简体中文版 目录 Rust 程序设计语言 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 2/562Rust 程序设计语言 简体中文版 11. 编写自动化测试 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 17. Async 和 await . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 17.1. Futures 和 async 语法 . .0 码力 | 562 页 | 3.23 MB | 9 天前3Coroutines and Structured Concurrency in Practice
demonstrated to justify switchingCallbacks vs coroutines // read length auto len = make_unique(); async_read(socket, buffer(len.get(), sizeof(int32_t)), [len = move(len)](auto ec, size_t len1){ && len1 == sizeof(int32_t)) { // read data auto buf = make_unique (*len); async_read(socket, buffer(buf.get(), *len), [buf = move(buf), len = *len] (auto read length int32_t len; co_await async_read(s, buffer(&len, sizeof(len)), use_awaitable); // read data auto buf = make_unique (len); co_await async_read(s, buffer(buf.get(), len) 0 码力 | 103 页 | 1.98 MB | 5 月前3julia 1.13.0 DEV
install juliaup in a shell with root privileges. cargo (Windows, Mac and Linux) To install Julia via Rust's cargo, run: cargo install juliaupChapter 4 Variables A variable, in Julia, is a name associated Base.AsyncCondition() wait(cond) The callback you pass to C should only execute a ccall to :uv_async_send, passing cond.handle as the argument, taking care to avoid any allocations or other interactions interactions with the Julia runtime. Note that events may be coalesced, so multiple calls to uv_async_send may result in a single wakeup notification to the condition. 28.17 More About Callbacks For more0 码力 | 2058 页 | 7.45 MB | 3 月前3So You Think You Can Hash
@ciura_victor Victor Ciura Principal Engineer Rust Tooling @ Microsoft 🐘 @ciura_victor@hachyderm.io 🦋 @ciuravictor.bsky.social 🦀 So You Think You Can Hash CppCon September 20242024 Victor Visual C++ @ciura_victor 🐘 @ciura_victor@hachyderm.io 🦋 @ciuravictor.bsky.social Oxidizer SDK 🦀 Rust Tooling 🦀2024 Victor Ciura | @ciura_victor - Unleashing 🦀 The Ferris Within 4 Motivation Title I'm not here to: convert anyone to 🦀 Rust start any language wars "sell the Rust snake oil" tell you to RiiR So, don't throw 🍅 Rust ❤ C++2024 Victor Ciura | @ciura_victor - Unleashing0 码力 | 119 页 | 6.54 MB | 5 月前3C++ Exceptions for Smaller Firmware
func3() -> Result{ return Ok(13); } Using Rust rustc --target thumbv7em-none-eabi -C opt-level="s" --emit=obj rust.rs 18400000000 <rust::combined::h7a7b0cc556a62e18>: 0: b5f0 push 2c: e00b b 0x46 2e: 4668 mov r0, sp Return Rust: Disassembled! objdump --disassemble --demangle rust.o > rust.S 30: f7ff fffe bl 0x30 34: e9dd 0100 ldrd r0, r1, [sp] fn func3() -> Result { Ok(13) } Using Rust (u64) rustc --target thumbv7em-none-eabi -C opt-level="s" --emit=obj rust.rs 18600000000 <rust::combined::hece36e1d2889c9fd>: 0: b5f0 0 码力 | 237 页 | 6.74 MB | 5 月前3Lifetime Safety in C++: Past, Present and Future
issues | ZDNET • Memory safety (chromium.org) • Implications of Rewriting a Browser Component in Rust - Mozilla Hacks - the Web developer blog • Google Online Security Blog: Memory Safe Languages in Profile Crubit: Adopting Rust’s Type System P2771: Thomas Neumann’s Dependency AnnotationsFuture of C++? C++ Core Guidelines’ Lifetime Safety Profile Crubit: Adopting Rust’s Type System P2771: Value SemanticsFuture of C++? C++ Core Guidelines’ Lifetime Safety Profile Crubit: Adopting Rust’s Type System P2771: Thomas Neumann’s Dependency Annotations Vale: Generational References +0 码力 | 124 页 | 2.03 MB | 5 月前3Cooperative C++ Evolution
JavaScript, C++, Objective-C) C++ examples CCured*, CFlat*, CNatural**, Cyclone**, D*, .NET*, Rust*… — C++11/14/17/20/23 Dart* ES 4, Python 3 TypeScript Swift ES 2-10 (except 4) C99/11/17, Python JavaScript, C++, Objective-C) C++ examples CCured*, CFlat*, CNatural**, Cyclone**, D*, VB.NET*, Rust*… — C++11/14/17/20/23 Dart* ES 4, Python 3 TypeScript Swift ES 2-10 (except 4) C99/11/17, Python JavaScript, C++, Objective-C) C++ examples CCured*, CFlat*, CNatural**, Cyclone**, D*, VB.NET*, Rust*… — C++11/14/17/20/23 Dart* ES 4, Python 3 TypeScript Swift ES 2-10 (except 4) C99/11/17, Python0 码力 | 85 页 | 5.73 MB | 5 月前3Julia 1.11.4
install juliaup in a shell with root privileges. cargo (Windows, Mac and Linux) To install Julia via Rust's cargo, run: cargo install juliaupChapter 4 Variables A variable, in Julia, is a name associated other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with0 码力 | 2007 页 | 6.73 MB | 3 月前3
共 91 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10