Rust

5346 readers
1 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

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
1
 
 

Hi! I've created a CLI tool for downloading Rust web books (like The Rust Programming Language) as EPUB, so that you can easily read them on your e-book reader. The tool is heavily based on this gist and a lot of proompting.

Check it out here: https://github.com/mawkler/rust-book-to-epub

2
 
 

That was a hard long adventure, massive refactoring with bug-fixing 🥵

3
 
 

Hello again!!

Sorry for the big delay in the announcements. I know it has been a long time I have not made any announcements, but I will try my best next time this doesn't happen again.

So, through the medium of this post I would like to share with you all the v1.15.0 major release version of the websurfx project which was released on the 25th of March.

If you are new, and you don't know what is websurfx then I would suggest taking a look at my previous post here:

https://programming.dev/post/2678496

Which covers in depth about what the project is and why it exists.

Credits

Before I share with you the changelog, what this release version means and a preview on what we are planning to work on for the next major release v2.0.0. I would first like to thank all our contributors and maintainers because of whom this was all possible. Specially I would like to thank spencerjibz, ddotthomas and evanyang1 who have been invaluable to the project. Also, Websurfx would not have been possible without alamin655 and xffxff early involvement.

Thanks 💖 to all the people involved in the project

Now, let's dive straight into what this release version actually means.

What does this release version means

This new release version v1.15.0 introduces the new ranking algorithm for search results on the search page which ranks the results based on the relevancy to the user's search query.

Changelog

The changelog of all the changes can be found here:

https://github.com/neon-mmd/websurfx/releases/tag/v1.15.0

Preview of the goals for the next major release

  • Different levels of privacy to choose from with the help of rust's conditional compiling features (In progress).
  • Even more engines will be supported.
  • Categories would be added to search results like images, news, etc.
  • More themes will be provided by default
  • More animations for the websurfx frontend will be supported.
  • Multi language support would be added.
  • I2p and tor support will be provided.
  • Reduce animations would be added for those who don't want animations and effects on the frontend.
  • And lots more ✨.
4
 
 

I have been searching for a simple way to copy loads of text from remote servers for a while. This includes files, but is sometimes also only multiple lines from stdout of a program. Oftentimes this is kinda hard to do in terminal emulators, so I wrote a very small program to copy text via Operating System Commands.

This allows the terminal emulator itself to copy the text directly into the host clipboard. No x11 pass-through needed.

Lots of text editors like vim (with oscyank-plugin) or helix already have a functionality like that, but opening large files just to copy them is stupid (also not all servers I admin have the oscyank or helix even installed).

If you want to know, if your terminal emulator supports osc52, please refer to the oscyank-repo, they have a nice list.

5
6
7
8
1
submitted 7 months ago* (last edited 7 months ago) by [email protected] to c/[email protected]
 
 

Slide with text: “Rust teams at Google are as productive as ones using Go, and more than twice as productive as teams using C++.”

In small print it says the data is collected over 2022 and 2023.

9
10
11
12
13
1
submitted 7 months ago* (last edited 7 months ago) by [email protected] to c/[email protected]
 
 

I have a struct that looks like this:

pub struct Game {
    /// A HashSet with the players waiting to play as account strings.
    lobby: HashSet<String>,
    /// capacity determines  how many people a match contains.
    capacity: u8,
    /// A vector of ongoing matches.
    matches: Vec<Match>,
    /// HashSet indicating for each player which match they are in.
    players: HashMap<String, usize>,
}

I realised that this won't work because if there are 3 matches (0, 1, 2) and I remove 1 because it ends, the players that used to point at 2 will be pointing outside the vector or to an incorrect match.

So I thought the obvious solution was to use a reference to the match: players: HashMap<String, &Match>. But this makes lifetimes very complicated.

What's a good way to deal with a case like these where data are interrelated in the same struct?

14
 
 

Hello All:

I am working on rust problems here. In the second question I solved it by simply adding the return statement for the function to modify. I am not sure what the lesson in ownership to walk away with in this problem. Any guidance?

15
16
 
 

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

17
 
 

I have a fun one, where the compiler says I have an unused lifetime parameter, except it's clearly used. It feels almost like a compiler error, though I'm probably overlooking something? Who can see the mistake?

main.rs

trait Context<'a> {
    fn name(&'a self) -> &'a str;
}

type Func<'a, C: Context<'a>> = dyn Fn(C);

pub struct BuiltInFunction<'a, C: Context<'a>> {
    pub(crate) func: Box<Func<'a, C>>,
}
error[E0392]: parameter `'a` is never used
 --> src/main.rs:7:28
  |
7 | pub struct BuiltInFunction<'a, C: Context<'a>> {
  |                            ^^ unused parameter
  |
  = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

For more information about this error, try `rustc --explain E0392`.
error: could not compile `lifetime-test` (bin "lifetime-test") due to 1 previous error
18
19
 
 

The focus of this release is the high-level API, which abstracts rendering together with physics (via Rapier3D). See the new “vehicle” example code for the reference.

vehicle example

In addition, blade-graphics-0.4 contains improved presentation API with control for color spaces and display synchronization, more texture formats, and an important platform bug workaround.

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

Empowering everyone to build reliable and efficient software.

23
 
 

Hey all,

I'm going to be moving on to my next project and have been thinking about doing an email client. I like Thunderbird, but the search is terrible, and I also want to tackle something that needs pretty high performance for processing emails etc.

Any suggestions or considerations I should think about?

I'll focus on just getting SMTP going in a CLI then I'll introduce some sort of frontend using Qt.

24
 
 

Always good to read about how you can speed up compile times. I mean, sword fighting on office chairs are all fun, but still....

25
1
Cargo env file? (lemmy.physfluids.fr)
submitted 7 months ago by [email protected] to c/[email protected]
 
 

Hello,

I have a project for which some machines have only a subset of features set. Currently, I write

cargo run --no-default-features --features "toto,titi" --bin my_bin

This is a bit cumbersome and I sometimes forget the --no-default-features --features part. I was wondering if there is a local config file that I could put in the directory to instruct cargo to use this particular subset of features. I guess this should be in the documentation, but I didn't find it.

view more: next ›