Rust Programming

8414 readers
97 users here now

founded 5 years ago
MODERATORS
126
127
128
129
130
6
.@eurorust is sold out! (cdn.fosstodon.org)
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 
 

.@eurorust is sold out!

This is your only chance to win a FREE virtual ticket!🎫👇

@rust @TauriApps

https://fosstodon.org/@crabnebula/111141727642280464

131
132
 
 

This is the resource I've been looking for. I'm working my way through the book but it gets in the weeds really early. It's all fun and games and then chapter 4 just hits like a brick wall. Amos does a tremendous job explaining the why behind things, in a more wheels to the pavement way.

133
134
 
 

I would like to benchmark my rustcode with criterion, but the information it presents to me do not match up. Here is some of the output I get

Benchmarking big/big decoding: Warming up for 1.0000 s
Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 306.4s.
big/big decoding    	time:   [632.40 ns 724.40 ns 899.80 ns]
                    	change: [+0.7649% +16.645% +46.889%] (p = 0.04 < 0.05)
                    	Change within noise threshold.
Found 2 outliers among 10 measurements (20.00%)
  1 (10.00%) high mild
  1 (10.00%) high severe

If it took a criterion only 724.40 ns to run the code, why couldn’t it run the code 10 times in 5 seconds. I looked at the outliers in the browser and the one outlier took 1.5 microseconds to run so this could not be the problem.

135
7
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 
 

Is there any library for the queueing mechanism?

What's used by the most - Cron? But a task or rather script executed by Cron won't access to the context of an application. Meaning, a task will have be an independent unit. Whereas I want is a library to use inside a project such that it'll have access to everything.

Anything similar to Sidekiq exist in Rust?

136
 
 

Spacebar is an already existing, open-source reimplementation of the Discord.com API. Chorus aims to provide tooling to write software for and with Spacebar, using Rust.

Polyphony was born out of my desire to finally learn Rust, and to write a client-application for Spacebar with it. However, things are never as straightforward as they seem. I sadly had to discover, that already existing Discord-libraries did not provide the set of features needed to properly connect to, and interact with a Spacebar instance.

I have learned a lot in the past 4-5 months, in which I basically commited all my spare time to writing Rust and working on this project, and I am still learning a lot, daily. My greater motivation with this project is:

  • Enable Rust Developers to write Software for Spacebar
  • Eventually write my client in pure Rust, and to make it darn good
  • Provide an alternative server implementation to Spacebar-Server in Rust
  • Create tooling that can rival Matrixes Privacy and Security, while being as easy to use as Discord. I truly believe that self-hosted communications Software like Matrix is being held back through endless complexity, making it impossible to convince any layperson to actually give it a fair shot. Also, most of the Matrix clients I have tried so far are simply... not very user friendly. Our end-goal is to create free, open-source and easy-to-use software, which can provide secure communication for the masses.

This library is currently in an early alpha-stage. Most APIs should be stable, but nothing is guaranteed, up until the 1.0 release.

Please check out Chorus and the Polyphony GitHub-org here if you're so inclined, and perhaps leave a star and join our Discord server, if you'd like to follow the project more closely. :)

137
138
139
140
 
 

I want to do basically this:

struct MyStruct < T> {
    data: T
}

impl < T> for MyStruct < T> {
    fn foo() {
        println!("Generic")
    }
}

impl for MyStruct < u32> {
    fn foo() {
        println!("u32")
    }
}

I have tried doing

impl < T: !u32> for MyStruct < T> {
    ...
}

But it doesn't seem to work. I've also tried various things with traits but none of them seem to work. Is this even possible?

EDIT: Fixed formatting

141
142
143
 
 

comments on r/rust

144
 
 

I've been reading a bit the tracing crate documentation, trying to find out if there's a way to rate limit logs.

What I refer with rate limiting, is that once a particular log has shown up with some frequency (x amount of times in a given time) then it won't be captured or shown anymore, until certain amount of time... This to avoid getting the logs space/buffer being eaten by just one, or a few high frequency errors for example.

Thanks !

145
146
 
 

Hello, I really need help figuring out Rodio audio playback for a rust project. I need to play a short audio clip of a casino wheel turning a certain amount of times in a loop. When I run the main function, the program plays the audio clip once and then stops completely. If anybody who has used Rodio can give me help it would be greatly appreciated. Also, I have tried using a longer duration in the play_sound function but it doesn't change anything. Thank you

147
148
149
150
view more: ‹ prev next ›