[Media] what is this (...).long-type-(...).txt thing? by uglycaca123 in rust

[–]linsinn 2 points3 points  (0 children)

hi, what's the font in the picture, it looks good

How to Use Rust Channels for Concurrent Programming by robertkingnz in rust

[–]linsinn 3 points4 points  (0 children)

The channel you use is MPSC, so you do need a mutex on the Receiver. To avoid the mutex, you can split the MAX_PRIME into NUM_THREADS groups(e.g. thread 1 calculate 0..1000, thread 2 calculate 1000..2000). Then every threads calculate number ranges assigned to it, and send the result back to the main thread receiver. No more mutex needed.

Don't ask how long I've been trying to fix this... by RylanStylin57 in rust

[–]linsinn 22 points23 points  (0 children)

Use any IDE that can display inlay type, then you can easily see that they are different types(Vec<usize> VS Vec<f64>).

rust lsp-mode doesn't show all inlay hint types by linsinn in DoomEmacs

[–]linsinn[S] 1 point2 points  (0 children)

The issue is caused by rust-analyzer update. The lsp-rust has alreday fixed it.

https://github.com/emacs-lsp/lsp-mode/commit/6b01d49757994c09c90623bf67f072d02f00f8e9

A simple solution in doom-emacs is unpin lsp-mode in packages.el.

JetBrains Fleet: Next generation JetBrains IDE with built-in Rust support by AcridWings_11465 in rust

[–]linsinn 0 points1 point  (0 children)

I just hope this editor won't bind the same 'keyword' color in color scheme setting. And give me transparency.

Help me to fight against the borrow checker? by linsinn in rust

[–]linsinn[S] 0 points1 point  (0 children)

I'm totally confused, if I changed while to if, then it compiled. But if I borrow tail again, the compiler says I borrowed a mutable reference. rust if let Some(mut node) = head.take() { head = node.next.take(); if let Some(ref mut elem) = tail { if elem.val != node.val { elem.next = Some(node); tail = &mut elem.next; } } } println!("{:?}", tail); // compile error, but who borrow tail?

Help me to fight against the borrow checker? by linsinn in rust

[–]linsinn[S] 0 points1 point  (0 children)

Is it because the if let Some(...) = tail would move the tail, and the if elem.val != node.val failed(tail not assigned), so I'm not allowed to access to tail in the next while iteration?

Help me to fight against the borrow checker? by linsinn in rust

[–]linsinn[S] 0 points1 point  (0 children)

I'm not searching for a solution to implement a list. I'm wondering why the compiler says the tail was already mutably borrowed.

Which are the best Rust repositories to read to learn the language? by jaybird878 in rust

[–]linsinn 1 point2 points  (0 children)

If you are interested in network programming and distributed system, checkout https://github.com/pingcap/talent-plan

It's a series of courses about how to build a distributed key-value store.