376
6
submitted 4 years ago by Sh3Rm4n@lemmy.ml to c/rust@lemmy.ml
377
9
Learn Rust by making a Rogue-like game (bfnightly.bracketproductions.com)
submitted 4 years ago by bbarker@lemmy.ml to c/rust@lemmy.ml

this tutorial tries to take you from zero (how do I open a console to say Hello Rust) to hero (equipping items to fight foes in a multi-level dungeon). I'm hoping to continue to extend the series.

378
1
submitted 4 years ago by KitaitiMakoto@lemmy.ml to c/rust@lemmy.ml
379
3
submitted 4 years ago by nixgoat@slrpnk.net to c/rust@lemmy.ml

Hi everyone! This is my first post on Lemmy and it's to showcase a little project I've been working on lately which is my first public project made in Rust.

It's a file management tool called Vento, which allows you to move files as if you're playing a text adventure. It's based on an original concept made by a friend of mine on Bash. It consists of three comands: vento, take and drop. I've recorded a demo on Asciinema to showcase its functionality.

asciicast

The project is available to install through Cargo and the source code is hosted on Codeberg. I'm open to suggestions!

380
10
submitted 4 years ago by cypherpunks@lemmy.ml to c/rust@lemmy.ml
381
16
Rust is coming to GCC (www.phoronix.com)
submitted 4 years ago by thervingi@lemmy.ml to c/rust@lemmy.ml
382
5
submitted 4 years ago by jokeyrhyme@lemmy.ml to c/rust@lemmy.ml
383
15
submitted 4 years ago by incici@lemmy.ml to c/rust@lemmy.ml

Hello all, I'm learning Rust after years of programming mainly in C/C++.

Python has a very neat shelve library: https://docs.python.org/3/library/shelve.html It's basically a dict (hash table), but is located on disk instead of memory. It's great for easy persistence and also for working with massive objects that won't fit into memory.

Is there anything similar for Rust? I could not find any, but I'm still learning Rust and could have missed it.

384
29
Nushell 0.61 | Nushell (www.nushell.sh)
submitted 4 years ago by jokeyrhyme@lemmy.ml to c/rust@lemmy.ml

Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines.

Today, we're releasing version 0.61 of Nu. This release includes UI improvements, many bugfixes, improved glob support, and more.

385
8
submitted 5 years ago by joojmachine@lemmy.ml to c/rust@lemmy.ml
386
13
387
17
submitted 5 years ago by IngrownMink4@lemmy.ml to c/rust@lemmy.ml

A simple note taking application written in Rust and GTK4.

Rnote aims to be a simple but functional note taking application for freehand drawing or annotating pictures or documents. It eventually should be able to import / export various media file formats. One main consideration is that it is vector based, which should make it very flexible in editing and altering the contents.

388
1
submitted 5 years ago by wolf4ood@lemmy.ml to c/rust@lemmy.ml

Hi! I was playing around with matrix-sdk-rust and i wrote just for fun this bot that converts twitter links into nitter ones.

389
2
390
4
submitted 5 years ago* (last edited 5 years ago) by nutomic@lemmy.ml to c/rust@lemmy.ml

Between Lemmy versions v0.8.10 and v0.9.0, we did a major database rewrite, which helped to improve compilation time by around 30% (see below). In this post we are going to explain which methods were effective to speed up Rust compilation for Lemmy, and which werent.

Compilation time comparison

Here is a comparison of debug compilation times for Lemmy. All measurements were done in with Rust 1.47.0, on Manjaro Linux and an AMD Ryzen 5 2600 (6 cores, 12 threads). Results are taken as the average of 5 runs each.

v0.8.10 v0.9.0-rc.11 improvement
Clean build 195s 129s 34%
Incremental build 23s 17s 26%

Build Graph

The build graph and statistics can be generated with the following command, which will generate a file cargo-timing.html.

cargo +nightly build -Ztimings

In our experience, it is really the most useful tool in order to speed up compilation time. There are a few ways to use it:

  • The table at the bottom shows which crates took longest to compile. You can try disable unused features for slow crates, or remove those dependencies entirely. If your own crates are slow, split them up (see below).
  • In the bar graph near the top, you can mouse over each crate to see which other crate it has to wait for in order to start compilation. You can try to remove these dependencies, or features that you don't need.

Splitting code into workspaces

This is often tricky to do, but proved to be the most effective way to speed up compilation. At the same time, it helped to better organise our code into independent parts, which will make future maintenance work easier.

As a first step, it is enough to split the code into crates which depend on each other linearly, as this is relatively easy and already helps to speed up incremental builds (because only part of the project needs to be recompiled when something is changed).

In case you have a particular dependency which takes very long to build, you should take all code which does not depend on that dependency, and move it into a separate crate. Then both of them can be built in parallel, reducing the overall build time.

Later you can try to reorganise your code so that crates in your project can be compiled in parallel. You can see below how we did that in Lemmy:

Before:

After:

As you can see in the before screenshot, all Lemmy crates are compiled linearly, which takes longer. In the after screenshot, at least some of the database crates are compiled in parallel, which saves time on any computer with multiple CPU cores.

For more details on how to use cargo workspaces, have a look at the documentation

Disabling debug info

This is very easy to do, as it only requires putting the following into Cargo.toml:

[profile.dev]
debug = 0

The effect is that debug information isn't included in the binary, which makes the binary much smaller and thus speeds up the build (especially incremental builds). We never use a debugger in our development, so changing this doesn't have any negative effect at all for us. Note that stack traces for crashes still work fine without debug info.

Here it is in the documentation

Removing dependencies

This only had limited success, for the most part. We weren't willing to remove or replace any of our dependencies, because then we would have to remove features, or have a lot of extra work to reimplement things ourselves.

However, there is one specific dependency where we could improve compilation time by around 50 seconds. Refactoring the database allowed us to remove diesel's 64-colum-tables feature. This was especially effective because diesel only has a single crate, and as a result is compiled on a single thread. This resulted in a period of 40 seconds where one thread would compile diesel, while all other threads were idle. There is still room for improvement here, if diesel can be split into multiple, parallel crates.

Lemmy issue with more details

With actix we noticed that it includes a compression library by default, which is useless in our case because we use a reverse proxy. Thanks to @robjtede from the actix for making the necessary changes to allow removing that library. In the end the effect was limited however, because the library could be built very early and in parallel to other things, without blocking anything. It should help with compilation on devices with few CPU cores at least.

Issue in the actix-web repo

Other optimisations

cargo bloat was commonly recommended in order to find large functions, and split them up. But that didn't help at all in our case, probably because our project is quite large. It might be more useful for smaller projects with less code and less dependencies.

It was also suggested to reduce macro usage, but there wasn't much opportunity in our case because diesel uses a lot of macros. We removed a few derive statements that weren't needed, but without any noticable effect.

391
11

Apologies if this question isn't really appropriate for this community, but Rust and Kotlin are my two favorite programming languages, and currently, I use both for different projects. However, I'm curious as to if people here think Kotlin still has a place when Rust exists? I'm specifically speaking architecturally: disregarding existing legacy code or support, do you think in the future, the Rust platform should replace the Kotlin platforms (JVM, LLVM Native, Android, Web) for everything Kotlin can do, or do you think Kotlin can do some things better than Rust?

392
6
submitted 5 years ago by ksynwa@lemmy.ml to c/rust@lemmy.ml

Haven't tried it yet but it looks super neat.

393
1

Development and project specifications are on their gitlab page: https://gitlab.com/robigalia

394
2
submitted 6 years ago by KitaitiMakoto@lemmy.ml to c/rust@lemmy.ml

Considering introducing to Plume.

395
3
submitted 6 years ago* (last edited 6 years ago) by AgreeableLandscape@lemmy.ml to c/rust@lemmy.ml

Genuinely serious since this is so much of a meme.

396
26
submitted 6 years ago by nutomic@lemmy.ml to c/rust@lemmy.ml
397
36

I'm looking to build something in Rust that requires being able to extract a variety of archive and compressed file formats, like various forms of compressed tar files, zip files, iso files, etc. The 7zip software suite is really good at both auto-detecting what format it's in and extracting almost anything you throw at it (it even dumps out the objects in Linux, Mac and Windows executables).

I was originally just thinking of including 7zip as a dependency and calling its command line tool from Rust so I can get it to do all the work, but is there a Rust library that is similarly versatile that I can use instead, or is 7zip actually my best option?

398
13
IntelliJ Rust Changelog #136 (intellij-rust.github.io)
399
-1
awslabs/flowgger (github.com)
submitted 6 years ago by KitaitiMakoto@lemmy.ml to c/rust@lemmy.ml

Flowgger is a fast, simple and lightweight data collector written in Rust.

Alternative to Fluentd and Logstash.

400
7
submitted 7 years ago by gregf@lemmy.ml to c/rust@lemmy.ml
view more: ‹ prev next ›

Rust Programming

9435 readers
1 users here now

founded 7 years ago
MODERATORS