Rust Programming

8414 readers
69 users here now

founded 5 years ago
MODERATORS
1
 
 

I came from Java, so it kind of makes sense.

I'm glad the Rust devs thought to allow disabling non-snake_case warnings.

This language is actually really great and versatile. (I also use tabs instead of spaces)

2
 
 
3
 
 

Hi there! Just wanted to share a project I worked on over the past 6 weeks. It is a boilerplate/template for a fairly secure API.

It now features:

  • An example API,
  • JWT auth (using APIkeys and username + password (+ 2 factor))
  • Key rotation,
  • Built-in HTTPS/HTTP2,
  • Multiple keys per account,
  • Usage tiers,
  • Role based access,
  • Healthcheck endpoint for monitoring and docker,
  • OpenAPI documentation generation,
  • And a lot more...

This was my first Rust project. I am always in for feedback :)

4
5
 
 

Are there some big projects/games that are released and made in bevy?

A lot of times tiny glade is mentioned, but I can not find a reliable source from the devs that it is made in bevy.

6
 
 

I've used Godot, which works great but I'm wondering if there are other ways.

Does anyone have experience using Qt with Rust and Qt Designer?

Are there any other drag and drop options that you think are viable?

7
18
submitted 3 weeks ago* (last edited 3 weeks ago) by [email protected] to c/[email protected]
8
9
 
 

An interesting video about actor programming in Rust.

10
 
 

Iced, a popular GUI Crate, used by system76 for their new DE, is getting default animation support in the development branch. The animations are based on the lilt crate. As far as I know the only missing part that needs to be done is, adding animations to the default widgets.

I assume in the next release it will be shipped with animation support.

I am so happy that this is coming and look forward to see animations in my gui applications.

11
 
 

cross-posted from: https://feddit.org/post/7326044

Inspired by Contex-Generic Programming, I made this macro, that allows you to write those generic implementations easily. This is kinda CGP, but simple and with better errors.

Ever repeat yourself implementing traits? Or wanted to easily swap out parts of your code, with (almost) no need to refactor? That is what this is for.

12
 
 

New Release 1.6.0 of Persy single file embedded storage is out

Persy is a single file transactional embedded storage, is scope is become a base of persistent databases implementations or for simple low level database to embed in application.

This is a new minor release 1.6.0 that include a simple feature that allow to create snapshots from the commit of a transaction, release post with all details here: https://persy.rs/posts/persy-1.6.html

13
14
 
 

This is what I've found:

In C and C++, two different operators are used for calling methods: you use . if you’re calling a method on the object directly and -> if you’re calling the method on a pointer to the object and need to dereference the pointer first. In other words, if object is a pointer, object->something() is similar to (*object).something().

What about Rust?

Rust doesn’t have an equivalent to the -> operator. Instead, Rust has what is called automatic referencing and dereferencing.

In other words, the following are the same:

p1.distance(&p2); (&p1).distance(&p2); Note: this automatic referencing behavior works because methods have a clear receiver-the type of self. Given the receiver and name of a method, Rust can figure out definitively whether the method is reading (&self), mutating (&mut self), or consuming (self).

I am not sureI understood the note correctly, what does it mean that there is a clear receiver? Also, doesn't Rust actually have an operator for dereferencing (*) as well?

15
16
 
 

axum is an ergonomic and modular web framework built with Tokio, Tower, and Hyper

17
 
 

It seems quite clear that rust users use hyper but few of them want to work on making it work for a C project like curl, and among existing curl users there is virtually no interest in hyper. The overlap in the Venn diagram of the two universes is not big enough.

18
20
Learning Rust (self.rust)
submitted 2 months ago by kionite231 to c/[email protected]
 
 

Hello,

I have started learning Rust. I have only made a fibonaci series program so far but I would make more complex program as I progress in learning Rust :D

19
 
 

axum is a web application framework that focuses on ergonomics and modularity.

Hey! If you're using axum, I would be happy if you tried the first release candidate of the upcoming v0.8.0, and shared any feedback you have. That's all :)

20
21
 
 

I am trying to understand the std::process::Termination trait.

As I'm not really used to read libraries, I took this as a challenge to try understanding a bit more about how to read them as well.

I think trying to build a library would give me better understanding, but for now...

Termination is quite easy, from the trait page I can see that this trait has single method: report, which returns an ExitCode.

pub trait Termination {
    fn report(self) -> ExitCode;
}

But when I try to dig in further and i read the page related to ExitCode, it confuses me a bit.

ExitCode is a struct, therefore it behaves like a type with many fields which define the types contained in the struct.

I cannot really understand what's the point of this type.. I don't see any fields defined in the struct and this part confuses me a lot:

The standard library provides the canonical SUCCESS and FAILURE exit codes as well as From for ExitCode for constructing other arbitrary exit codes.

I even thought this meant it was an enum which had the SUCCESS, FAILURE etc as variants, but this does not seem the case.

Can you help me to understand how this specific structs work, what exactly does it do and how I should read library pages like this one?

22
21
submitted 2 months ago* (last edited 2 months ago) by [email protected] to c/[email protected]
 
 

I was recently furloughed from work, so in between job applications, I decided to polish off Sonarr support in my Managarr TUI. Thus, I'm very proud to announce the beta release of Managarr with Sonarr support!

TL;DR: Managarr is a TUI and CLI for managing your Servarr instances. As of now, it now supports both Radarr and Sonarr and all the features that are available in the UI are also available in the CLI for scripting and additional automation.

The new version has the following features:

  • Wider platform support (Windows, Mac, Linux, x86_64 and arm64)
  • View your library, downloads, blocklist, episodes
  • View details of a specific series, or episode including description, history, downloaded file info, or the credits
  • View your host and security configs from the CLI to programmatically fetch the API token, among other settings
  • Search your library
  • Add series to your library
  • Delete series, downloads, indexers, root folders, and episode files
  • Trigger automatic searches for series, seasons, or episodes
  • Trigger refresh and disk scan for series and downloads
  • Manually search for series, seasons, or episodes
  • Edit your series and indexers
  • Manage your tags
  • Manage your root folders
  • Manage your blocklist
  • View and browse logs, tasks, events queues, and updates
  • Manually trigger scheduled tasks
  • Manually trigger scheduled tasks
  • And more!

Here's some screenshots of the Sonarr tab:

Thanks to everyone's feedback when I first posted the alpha release here, this version sports a handful of additional performance improvements and platform support.

This is now technically in beta, so if anyone encounters any issues, please let me know!

23
24
25
 
 

cross-posted from: https://lemmy.world/post/22673996

This mod is written in an unconventional way: it is written in Rust. The Rust code is here. It uses JNI and JVMTI to interact with Java objects. The only Java code in this mod is for loading the compiled native binary into memory.

view more: next ›