Rust

8120 readers
14 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 3 years ago
MODERATORS
1
2
 
 

Tutorial Link

This chapter helps builds a navigable 3D viewport from scratch in Bevy 0.19, starting with the three essentials of any scene (a camera, a light, and a mesh).

We'll be working on more features in the upcoming chapters, stay tuned :)

3
4
5
6
 
 

Thing I stumbled upon:

I added boolean argument & if statement inside sort_unstable_by closure:

//from
|&a, &b| compare(a, b) 

//to
|&a, &b| if is_reverse { compare(b, a) } else { compare(a, b) }

I expected binary to grow slightly, but actually got 1KB smaller.

I dug into & found that the reason is: quicksort fn became 980 bytes smaller.

Why? Not sure. Inlining looks same, quicksort just has fewer instructions.

target: arm-unknown-linux-gnueabihf

commit: https://github.com/tracyspacy/fli/commit/a87a98be77cc1972a53e6399716a227d1135e76b

details: https://pastebin.com/qJdTw49n

OC by @tracyspcy@lemmy.ml

7
 
 

Tutorial Link

Async Rust can be frustrating because the compiler errors feel disconnected from your intent, so you try to fix things without understanding why.

Even working code can hang or run out of order at runtime, with no obvious place to begin debugging.

This chapter guides you to build the state machine behind an async fn by hand, then uses that as a model to reason about common async bugs and compiler errors.

Please let me know in comments if my async series is helpful or not.

8
9
10
11
 
 

We finally run the libcore tests with rustc_codegen_gcc in the CI of the Rust repo, which should help us a lot with the future syncs. We also finally merged a few more GCC patches, so the gap with upstream is slowly decreasing.

12
13
 
 

I'm kinda still shopping around for a good graphical filemanager. This is of course still very raw, but the tagging system might actually take care of the bookmark aspect, which is very important to me.

14
15
16
17
 
 

Hocusfocus is a tool I made to track how long you spend on certain tasks (Working, Studying, Wasting time).

It was initially written in Swift, but was rewritten in Go a while ago. Now, I’ve rewritten it in Rust.

18
19
20
 
 

geteilt von: https://programming.dev/post/52041408

Have you ever thought about sharing data across language boundaries without serialization? This blog post highlights the challenges behind this endeavor and how they can be overcome.

Note: I'm not the original author of the blog post, but since the author does not have a programming.dev account, I post it on his behalf.

21
 
 

Who Runs Your Rust Future? Hands-On Intro to Async Rust

I wrote a hands-on intro to async Rust where you build a future and the runner that drives it. It assumes you've written async/await in JS and know Rust basics (structs, enums, closures). No prior async Rust needed.

What the first chapter covers:

  • Who actually runs your async code in Rust
  • What calling an async function actually does, compared to a JS Promise
  • What 'running' a future actually means, step by step
  • The waker: how a future says when it's worth polling again, so you can sleep instead of spinning the CPU
  • Building a Oneshot channel by hand
  • Writing block_on, a runner that drives a future to completion

Everything is built from std only, no dependencies. Also, this chapter is a part of a bigger series that goes deep into async Rust.

22
23
24
 
 

Is there any guide, tutorial or other resource that helps in making a REPL-based DSL using rust

25
 
 

Bevy Game Engine Explained Visually

A visual tour of how Bevy helps you compose complex, emergent games from small independent systems and a data-driven architecture.

view more: next ›