Rust

5981 readers
57 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
26
 
 

I was using Iced as a dependency, but wanted to tweak its source code for some reason, so I jumped into the folder where cargo downloads dependencies, and went into iced_wgpu 13.5 (I think that's the version).

I could make a change, then run

cargo clean -p iced_wgpu && cargo check

in my other project for instant feedback, yet it took rust_analyzer at least 5 whole minutes to stop hallucinating.

Can I disable some functionality of rust_analyzer? I only use it for jump-to-definition, linting and syntax highlighting; I don't even use autocomplete.

Setup:

  • Desktop that thermally throttles only when both the IGPU and the CPU are under full load, and is cool otherwise.

  • CPU: Intel I5-7500

  • RAM: 8 GiB DDR-4

  • Editor: NVIM v0.11.0-dev | Build type: RelWithDebInfo | LuaJIT 2.1.0-beta3 (I had the same issue with other versions as well).

TLDR

What can I disable in rust_analyzer to boost performance while maintaining jump-to-definition, linting and syntax-highlighting, or what can I do to boost rust_analyzer for big projects in general?

27
 
 

I really like the idea of a package/dependency manager. It just seems that when ever I am reading a tutorial and they want to import something that is not standard they say write this in to your TOMOL not cargo install it. Like when reading python docs they all say to use pip or something. Sorry it just seems that Cargo is somewhat overlooked or is it just my perception?

28
29
30
31
32
 
 

This is a blog post that really is about C++, but with a look at how Rust does things. So, this is an interesting C++/Rust comparison for once.

33
 
 

Last week I basically duplicated the serialization code to provide better debug output.... today, I see this pass in my Mastodon feed. πŸ˜€ Well... what are the odds... most likely close to 100% according to how the universe seems to operate.

34
 
 

Kellnr, the crate registry for Rust got an update. The latest version contains bug fixes and dependency updates. If you are interested in hosting private crates that must not be on crates.io, check it out.

35
 
 

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

36
 
 

A short post on how variable names can leak out of macros if there is a name collision with a constant. I thought this was a delightful read!

37
38
39
40
41
42
 
 

Hi. I've been learning Rust for a while, and I want to take on an actual project now to learn even more. I need to be pointed in the right direction for one aspect of the affair, and I hope someone here can help me.

I want to create a deck tracker for Hearthstone that runs natively in Linux. This is, on the back end, a fairly simple matter of parsing a constantly updated file that tracks everything that happens in the game. On the front end, however, I want to create a window that sits on top of the fullscreen Hearthstone window and shows me stuff. The "stuff" doesn't have to be images or anything fancy, I'll take whatever I can get, but I don't know how to get started on this part.

So the task is as follows: Create an overlay on top of the fullscreen Hearthstone client, preferably under Wayland, and update it constantly with new information about cards drawn, cards left in deck, that sort of thing.

How do I tackle this problem? Are there any crates that'll let me create such a window and render stuff to it? How would you approach the problem?

Thanks in advance.

43
44
45
 
 

I've always been curious about this. If I were to take a snapshot of a git repo at a particular point in time, who would be the top contributors by active lines of code? And then, what type of files have they contributed the most? So I built this little tool.

I've been wanting to learn rust for quite some time now and this was one of my first projects in it. It was a lot of fun!

It uses git under the hood to obtain the information and it's nothing fancy, but keen to hear what you think.

46
9
submitted 2 months ago* (last edited 2 months ago) by xameer@mathstodon.xyz to c/rust@programming.dev
 
 

#rust analyzer question for #emacs folks
In client more I see run and debug
But gui emacs I don't ..
why
pfa

@rust

47
48
49
 
 

Hi all.

I want to develop a plugin system within my program, and I have a trait that functions defined by plugins should implement.

Currently, my code gets all the functions in a HashMap and then calls them by their name. Problem is, I have to create that hashmap myself by inserting every function myself.

I would really appreciate it if there was a way to say, suppose, all pub members of mod functions:: that implement this trait PluginFunction call register(hashmap) function. So as I add more functions as mod in functions it'll be automatically added on compile.

Pseudocode:

Files:

src/
β”œβ”€β”€ attrs.rs
β”œβ”€β”€ functions
β”‚Β Β  β”œβ”€β”€ attrs.rs
β”‚Β Β  β”œβ”€β”€ export.rs
β”‚Β Β  └── render.rs
β”œβ”€β”€ functions.rs
β”œβ”€β”€ lib.rs

Basically, in mod functions I want:

impl AllFunctions{
    pub fn new() -> Self {
       let mut functions_map = HashMap::new();[[
       register_all!(crate::functions::* implementing PluginFunction, &mut functions_map);
       Self { function_map }
  }
}

Right now I'm doing:

impl AllFunctions{
    pub fn new() -> Self {
       let mut functions_map = HashMap::new();[[
       crate::functions::attrs::PrintAttr{}.register(&mut functions_map);
       crate::functions::export::ExportCSV{}.register(&mut functions_map);
       crate::functions::render::RenderText{}.register(&mut functions_map);
       // More as I add more functions
       Self { function_map }
  }
}
50
view more: β€Ή prev next β€Ί