Rust

5999 readers
64 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 1 year ago
MODERATORS
401
 
 

l just released a new version of to-html. I created to-html a few years ago for my blog. It is very easy to use: When you want to include the output of a command on a website, run it with to-html:

to-html "cargo clippy"

Then copy and paste the output into your website. to-html comes with some options to customize its output. Starting with this release, you can create a configuration file, so you don't need to repeat the same CLI arguments every time you use to-html. This release also adds shell completions, a way to customize terminal colors via CSS, and a flag to not print the shell prompt. A big thank you to the contributors who implemented these features!

402
403
 
 

Kellnr, the Rust registry to self-host your crates has a new release. Switched from Rocket to Axum, removed the git index and refactored settings.

404
405
406
 
 

Abstract This project introduces Rustlantis, a novel fuzzer capable of generating programs in Rust’s Mid-level Intermediate Representation that are deterministic and free from Undefined Behaviour. It has uncovered 13 previously-unknown bugs in the Rust compiler and LLVM which has caused miscompilations as well as crashes.

407
 
 

I've been writing this series of articles for a while now, and I've finally worked through all the parts of the 5 lines of python code to finish the Chapter 1 project. Written entirely in Rust of course.

This is part 6 of the series.

Come check it out

408
409
16
submitted 11 months ago* (last edited 11 months ago) by runiq@feddit.de to c/rust@programming.dev
 
 

In my previous post, I said that the single best thing the Rust project could do for users is stabilize AsyncIterator. I specifically meant the interface that already exists in the standard library, which uses a method called poll_next. Ideally this would have happened years ago, but the second best time would be tomorrow.

410
411
412
 
 

I think it's actually quite a nice way to think about it. Thinking in terms of memory is much easier than thinking in terms of sections of code.

413
414
415
 
 

This is a really simple silly thing I just realized, but I noticed I have a lot code that looks something like this:

fn foo() -> Result<(), Error> {
    // do something
}

fn bar() -> Option<()> {
    let Ok(f) = foo() else {
        return None;
    };
}

I hated that if-statement. I realized today that I could simplify to:

fn bar() -> Option<()> {
    let f = foo().ok()?;
}

And that cleaned up my code a lot. It's a tiny thing, but when it's okay to discard the error from the result, makes such a big difference when you have a lot of them!

416
4
submitted 11 months ago* (last edited 11 months ago) by iso@lemy.lol to c/rust@programming.dev
 
 

Especially the errors related to traits are very difficult to me. Is there a trick? Will I get used to it? Or am I just a failure? :D

Like WTH is this?

the trait bound '(diesel::sql_types::Uuid, diesel::sql_types::Text, diesel::sql_types::Nullable, diesel::sql_types::Timestamp, diesel::sql_types::Timestamp): diesel::query_dsl::CompatibleType' is not satisfied the following other types implement trait 'diesel::query_dsl::CompatibleType': (ST0,) (ST0, ST1) (ST0, ST1, ST2) (ST0, ST1, ST2, ST3) (ST0, ST1, ST2, ST3, ST4) (ST0, ST1, ST2, ST3, ST4, ST5) (ST0, ST1, ST2, ST3, ST4, ST5, ST6) (ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7) and 24 others required for 'SelectStatement, DefaultSelectClause>, NoDistinctClause, ..., ..., ...>' to implement 'diesel_async::methods::LoadQuery<'_, _, models::Artist>

Or this:

the variant or associated item 'as_select' exists for enum 'Option<Image>', but its trait bounds were not satisfied the following trait bounds were not satisfied: 'std::option::Option<models::Image>: diesel::Selectable<_>' which is required by 'std::option::Option<models::Image>: diesel::SelectableHelper<_>' '&std::option::Option<models::Image>: diesel::Selectable<_>' which is required by '&std::option::Option<models::Image>: diesel::SelectableHelper<_>' '&mut std::option::Option<models::Image>: diesel::Selectable<_>' which is required by '&mut std::option::Option<models::Image>: diesel::SelectableHelper<_>'

or this:

the trait bound 'schema::image::columns::id: diesel::SelectableExpression<schema::artist::table>' is not satisfied the following other types implement trait 'diesel::SelectableExpression<QS>': <schema::image::columns::id as diesel::SelectableExpression<diesel::query_source::joins::Join<Left, Right, diesel::query_source::joins::Inner>>> <schema::image::columns::id as diesel::SelectableExpression<diesel::query_source::joins::Join<Left, Right, diesel::query_source::joins::LeftOuter>>> <schema::image::columns::id as diesel::SelectableExpression<schema::image::table>> <schema::image::columns::id as diesel::SelectableExpression<diesel::query_builder::SelectStatement<diesel::query_builder::FromClause<From>>>> <schema::image::columns::id as diesel::SelectableExpression<diesel::query_source::joins::JoinOn<Join, On>>> <schema::image::columns::id as diesel::SelectableExpression<diesel::query_builder::Only<schema::image::table>>> required for '(id, url, width, height, color, updated_at, created_at)' to implement 'diesel::SelectableExpression<schema::artist::table>' the full type name has been written to './target/debug/deps/server-25bcf4cf7c62d3bf.long-type-2030200755981097212.txt' 3 redundant requirements hidden required for '(diesel::expression::select_by::SelectBy<models::Artist, _>, diesel::expression::select_by::SelectBy<std::option::Option<models::Image>, _>)' to implement 'diesel::SelectableExpression<schema::artist::table>' required for 'SelectStatement<FromClause<table>, DefaultSelectClause<FromClause<table>>, NoDistinctClause, WhereClause<...>>' to implement 'diesel::query_dsl::methods::SelectDsl<(diesel::expression::select_by::SelectBy<models::Artist, _>, diesel::expression::select_by::SelectBy<std::option::Option<models::Image>, _>)>' the full type name has been written to './target/debug/deps/server-25bcf4cf7c62d3bf.long-type-3023492822805157679.txt'

417
418
29
submitted 1 year ago* (last edited 1 year ago) by snaggen@programming.dev to c/rust@programming.dev
 
 

#fishshell rewrite-it-in #rust progress, 2023-11-20

76909 rust lines added

48105 / 77063 C++ lines removed

▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░ 62 %

419
 
 

The one dealbreaker for me in Typst is the current lack of locale-aware decimal separators. The rest of it is so good that I've donated a couple times.

420
 
 

I'm a complete beginner in programming with no prior experience, and I want a tutor/mentor to learn Rust for software(GUI, games, software in general) development and, eventually, kernel development(microkernels, IPC, specifically). I pay, of course. (Also, another note, I dislike UNIX (philosophy wise), so I would be looking to get experience in non-UNIX kernel development but also learn UNIX stuff as well.) Furthermore, to note, is I'm interested in game development.

I have a document from my previous tutor in this outlining the stuff I am keen to learn, practically a syllabus, so if you want to see it dm me :3.

421
422
 
 

Rocket 0.5 Released together with RWF2, a nonprofit organization designed to support Rocket and the surrounding ecosystem, financially and organizationally.

423
 
 

Check out Blade: it's a purely ray-traced renderer, with asset pipeline and egui integration, built on top of a thin low-level GPU abstraction.

I've just released blade-graphics-0.3, blade-render-0.2, and other associated crates. I believe it's now usable externally, and I'm dogfooding it myself.

Major rendering additions:

  • tangent space generation and normal mapping
  • spatio-temporal reservoir resampling (ReSTIR)
  • environment map importance sampling, it can load EXR and HDR
  • Spatio-temporal variance-guided de-noising (SVGF)

In addition, shaders are now considered assets and can have includes, shared enums and bitflags with your Rust code. The "scene" example is practically a scene editor: it allows dropping new objects, manipulating them via egui-gizmo, in addition to configuring the rendering.

424
 
 

The Prettier Bounty is a challenge to write a prettier-compliant pretty printer in Rust

425
 
 

Greetings to all.

I have spent the last couple of evenings learning about Rust and trying it out. Wrote a simple cli calculator as a first thing and thought I would improve it by making it available over http.

I was actually a bit surprised to find that there was no http tooling in the standard library, and searching online gave me an overload of information on different libraries and frameworks.

I ended up implementing my own simple HTTP server, might as well as this is a learning project.

Now I have it working, and while it isn't perfect or done, I thought that this would be a good time to check what things I am doing wrong/badly.

Which is why I am here, would love to get some pointers on it all to make sure I am going in the right direction in the future.

The project is hosted here: https://github.com/Tebro/rsimple_http

view more: ‹ prev next ›