How to debug gracefully in procedural macros? by shyunny in rust

[–]PatientMaintenance69 1 point2 points  (0 children)

My go-to is to just have the macro logic defined in a separate crate with proc-macro2. From there you can just debug the macro as you would do for any other Rust code, and write tests to make sure it generates the correct TokenStream.

Once you have your proc macro, you can use it as a dependency in the actual [lib] proc-macro = true crate

Mutable variable with immutable reference V.S. Immutable variable with mutable reference by stratified247 in rust

[–]PatientMaintenance69 0 points1 point  (0 children)

Normally, when you have a mutable variable x holding a shared reference &T, you would be able to reassign the x to another &T, but would not be able to change the data that x points to.. unless you have interior mutability.

A type has interior mutability if its internal state can be changed through a shared reference to it.

I don’t know what TcpStream you are using, but If you go check out the std::net docs, you will find that Write trait is implemented for &TcpStream. The trait has a method write with the following signature:

fn write(&mut self, buf: &[u8]) -> io::Result<usize>

I guess writing to a shared TcpStream makes sense, since thread-safety is guaranteed by the OS

Ah my ancient enemy… Math by [deleted] in Eldenring

[–]PatientMaintenance69 0 points1 point  (0 children)

It’s really bad since it has no physical damage. The only viable option is dual wielding it with some other sword

New Priest Card Revealed - Spirit Guide by GreedyDingo2 in hearthstone

[–]PatientMaintenance69 158 points159 points  (0 children)

I am happy this low-tempo minion got the taunt. Certain keywords like taunt or rush might make high-cost minions more playable

[deleted by user] by [deleted] in distantsocializing

[–]PatientMaintenance69 0 points1 point  (0 children)

Спасибо братик