1
75

I recently started learning rust, and I was ready for one hell of a fight. I heard all those horror Storys about the compiler complaining about every single detail and that developing rust means having a constant fight with the compiler about seemingly irrelevant things. However, so far I have to tell, that while its somewhat true, that the compiler is somewhat picky, it is incredibly helpful. Never before have I seen such good and helpful compiler messages. It not only says what you did wrong, but also gives direct help on what to do to fix your code. I also really like, that it gives you direct references to the rust book in the compiler messages.

Prior to starting my journey with rust I did quite a lot of python, some C and some bash and their interpreter/compiler messages are nothing when comparing them with rust. Especially the bash error messages are awful if you do not know what they mean and how to fix them.

2
15
3
8
This Week in Rust 642 (this-week-in-rust.org)
4
25
Announcing rustup 1.29.0 (blog.rust-lang.org)
5
25
submitted 1 week ago* (last edited 6 days ago) by silly_goose@lemmy.today to c/rust@programming.dev

Rust analyzer and compilation are very slow. My system is heating up, running out of ram and disk space. I have 8 GB ram.

I use helix editor.

edit: thank you for all your suggestions. I am breaking up the project into smaller crates to see if that makes a difference.

I got the biggest improvements from zram and sccache. With zram my memory usage stays at 90% instead of fully running out when rust-analyzer starts.

6
36
7
19
8
11
submitted 2 weeks ago by cm0002@infosec.pub to c/rust@programming.dev

Hi everyone! I want to introduce a project that I’ve been working on for 6 days with ARandomOSDever. It currently has only a few layout functions: Spacing, Direction (Row, Column), Padding, Margin, Min/Max Size, Align, and it already supports no std. I’m sharing this with you to get feedback, both good and bad. I would really appreciate your thoughts

GitHub repo: https://github.com/dest-hq/axes

Crates: https://crates.io/crates/axes

I’m not entirely sure, yet why Axes performs faster than Taffy, maybe it’s because Taffy has many layout functions that affect performance.

Here’s a benchmark (Axes 0.2.0 vs Taffy 0.9.2).

| Benchmark | Axes | Taffy | Difference | |


|


|


|


| | Tree: 1,000 Nodes | 15.889 µs | 89.114 µs | 139.472% | | Tree: 10,000 Nodes | 1.1744 ms | 1.0698 ms | 4.45988% | | Tree: 100,000 Nodes | 8.7379 ms | 33.083 ms | 116.426% | | Compute: 1,000 Nodes | 17.423 µs | 39.317 µs | 77.1731% | | Compute: 10,000 Nodes | 176.51 µs | 446.35 µs | 86.6455% | | Compute: 100,000 Nodes | 1.7988 ms | 14.976 ms | 157.107% |

Hope you have an awesome day

Developer @mxghj@programming.dev

9
72
10
12
11
19
12
24
13
21
submitted 3 weeks ago by u_1f914@lemmy.world to c/rust@programming.dev
14
34
submitted 3 weeks ago* (last edited 3 weeks ago) by xoron@programming.dev to c/rust@programming.dev

Id like to share my implementation of the signal protocol that i use in my messaging app. The implementation is in rust and compiles to WASM for browser-based usage.

Its far from finished and im not sure when its a good time to share it, but i think its reasonable now.

The aim is for it to align with the official implementation (https://github.com/signalapp/libsignal). That version was not used because my use case required client side browser-based functionality and i struggled to achieve that in the official one where javascript is used but is targeting nodejs.

There are other nuances to my approach like using module federation, which led to me moving away from the official version.

While i have made attempts to create things like audits and formal-proof verication, i am sharing it now if there is feedback about the implementation. Any outstanding issue i may be overlooking? Feel free to reach out for clarity on any details.

This signal implementation is for a p2p messaging app. See it in action here: https://p2p.positive-intentions.com/iframe.html?globals=&id=demo-p2p-messaging--p-2-p-messaging&viewMode=story

15
8

We finally have rustup distribution for rustc_codegen_gcc! Now I'll get back to build rustc for a target not currently supported by Rust.

16
23
submitted 3 weeks ago by nemeski@mander.xyz to c/rust@programming.dev
17
21
submitted 1 month ago by nemeski@mander.xyz to c/rust@programming.dev
18
3
submitted 1 month ago by tracyspcy@lemmy.ml to c/rust@programming.dev

Crossposted from https://lemmy.ml/post/43115912

In this example, all todo operations — from simple CRUD to tasks own instructions — are executed by a virtual machine.

The concept is that any kind of automation or workflow can be enabled by task instructions executed by the VM, rather than hardcoded functions in the app. It’s close to the concept of rules engines.

There are 4 demo task instructions:

  • chain - Creates next task once when another completes. Removes calldata after call - called once
  • either - Sets complete if either one or another task is completed + deletes not completed task (see gif)
  • destructable - task self destructs when it's status set to complete
  • hide - Keeps task hidden while specified task's status is not complete.

It is possible to add your own instructions to calldata.toml and use them within todo example:

cargo run -- add <TASK_TITLE > -calldata <INSTRUCTION_NAME> <PARAMETERS>

repo: https://github.com/tracyspacy/spacydo

todo example : https://github.com/tracyspacy/spacydo/tree/main/examples/todo

19
31
Announcing Rust 1.93.1 (blog.rust-lang.org)
submitted 1 month ago by nemeski@mander.xyz to c/rust@programming.dev
20
14

Kellnr - the open source Rust crate registry - released a new major version. Many month of work went into it. Check it out, if you want to host your own crates or custom toolchains for Rust!

21
45
submitted 1 month ago* (last edited 1 month ago) by cows_are_underrated@feddit.org to c/rust@programming.dev

Someone once told me somewhere, that if I am trying to learn rust, I should learn C first, so that I know how to shoot myself in the foot, learning to avoid doing so, so that the borrow checker of rust doesnt seam to unforgiving (since you somewhat know, what happens if you dont follow best practices). So thats what I did (somewhat) for the past 6 months. I wrote some stuff in C, but mainly I had quite of a deep dive into operating systems (mainly linux), working mechanics of memory and the CPU and a lot more (I will try to make a list of the stuff I learned and the ressources used below). My question to you is, if there are any additional concepts/things I should learn beforehand, to start learning rust.

The (somehwat complete) list of things learned for the past 6 months:

  • Stack Behaviour (Why its so fast, what its used for,....)
  • The heap (why its useful, but dangerous)
  • Theoretical Concepts of threading (Concurrency vs. paralellism)
  • Theory of race conditions (how and why they occur, and some tricks to avoid them)
  • Concepts of Memory allocation on an OS level (Address Spaces)
  • System calls and the separation between kernel and user space
  • Signals
  • Basics of Inter-Process-Communication
  • CPU-Scheduling (CPU-/IO-Bursts, context switches, different scheduling algorithms up to ROund RObin (based on complexity))
  • How loops, conditions and function calls get implemented in Assembly / how the CPU performs these
  • Bitwise Operations

I probably forgot a significant part of the stuff I learned, but its quite hard turning it into a list, without writing a whole book, and trying to remeber everything.
Most of these things are mainly theory, since I havent gotten around to code that much in C. However I definitively have some experience in C. This includes on how to handle pointers, basics of handling the heap, strings (even if I absolutely hate them in C) and some system calls (I played around with sbrk for custom memory management without malloc).

The ressources I used for learning is primarily the YouTube-Channel CoreDumped (I highly recommend), LowLevel and some other ressources, but these were the most helpful ones.

So, feel free to send me down my next rabbit hole before starting rust.

22
21
23
20
submitted 1 month ago* (last edited 1 month ago) by innocentz3r0@programming.dev to c/rust@programming.dev

Supac is a declarative package manager written in Rust fully scriptable in nushell. It's meant to make it easy to use the native package managers in existing distros without going through the associated headaches of using Nix, while maintaining the ergonomics of structured data in nushell.

Currently supported backends are:

  • Archlinux and derivatives
  • flatpak
  • cargo/cargo-binstall
  • uvx (packages only for now)
  • rustup toolchains

I daily drive it, and it works well. Feel free to give it a try!

24
47
submitted 1 month ago* (last edited 1 month ago) by costalfy@programming.dev to c/rust@programming.dev
25
32
submitted 1 month ago* (last edited 1 month ago) by costalfy@programming.dev to c/rust@programming.dev
view more: next ›

Rust

7860 readers
97 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 2 years ago
MODERATORS