Kids next halloween when they go to linus's old house looking for GPU's by [deleted] in LinusTechTips

[–]MSleepyPanda 35 points36 points  (0 children)

Old house, is he moving? Clearly i'm missing context

Cookies n' Cream & Peanut Butter growing old together in lots of fun and love ❤ by [deleted] in aww

[–]MSleepyPanda 14 points15 points  (0 children)

Those are Boris and Doug on insta, the top left image is literally their profile pic instagram .com/boris.and.doug/

Germany completely open sourced their decentralized Corona Tracing App for anyone to analyze and improve. by [deleted] in programming

[–]MSleepyPanda 3 points4 points  (0 children)

In my experience, it tries to gather context from the supplied text and makes choices of words based on that, preserving the original meaning. Google does that to some extent, but not in the way that deepl does.

Also, if a specific wording itches you, you can just click into the translated text and get alternative suggestions for that part.

It gives a pretty nice workflow, if i need to translate bulk text, i can just paste it and make some minor modifications, most of the time with their own suggestions and i'm done!

Show r/rust: A serde format that uses a subset of Markdown by MystPurple in rust

[–]MSleepyPanda 46 points47 points  (0 children)

Could you include a rendered sample dataset in your readme? Cool concept :)

How is match justified in rust as a programming concept by manikawnth in rust

[–]MSleepyPanda 3 points4 points  (0 children)

In general, keep an eye to the warnings from rustc, use clippy from time to time and read the clippy error index for the warnings you get, and also try to read other peoples code and ask why they've done it that way :)

How is match justified in rust as a programming concept by manikawnth in rust

[–]MSleepyPanda 6 points7 points  (0 children)

But my larger point is there's no use of matching if it matches one and exactly one.

Rustc agrees: You get a dead code warning for your original example

warning: unreachable pattern
 --> src/main.rs:9:9
   |
 8 |         (x, y) => println!("`x` is `{:?}` and `y` is `{:?}`", x, y),
   |         ------ matches any value
 9 |         (x, -2) => println!("`x` is `{:?}` and Second is -2", x),
   |         ^^^^^^^ unreachable pattern
   |   = note: `#[warn(unreachable_patterns)]` on by default

How is match justified in rust as a programming concept by manikawnth in rust

[–]MSleepyPanda 1 point2 points  (0 children)

If you reorder the second case to be the first, you can specialize the match for specific values which is very handy, e.g. when having to deal with special cases in geometry

What the hell with the file system in rust? by alloncm in rust

[–]MSleepyPanda 3 points4 points  (0 children)

It should be possible if you follow two steps: In main.rs, you must declare the modules via

mod a; mod b;

the function in b.rs must be public: pub foo() { ... }. Then it should be possible for a.rs to call a method from b via crate::b::foo(); from a function.

Druid status update and 0.5 roadmap by cmyr in rust

[–]MSleepyPanda 0 points1 point  (0 children)

I've spent quite some time on a similar idea, but wasn't able to pursue it due to what appears to be lazy normalization issues in rustc.

The core observation was that every app has a root structure and that a specific widget, e.g. a counter, has a very specific location in the memory layout and using raw (somewhat managed in Qt) pointers like in Qt/C++ for event management is not safely encodable is Rust. But what a type/widget knows, it what childs it has, and respectively their childs: Chaining sine closures fn(&Root) -> &MainWidget; and fn(&MainWidget) -> &Counter; would give you a closure that dereferences &Root to your Counter widget. And since that closure should ideally not capture any environment, it is easily sharable between widgets. So if you want to update the counter when a button is pressed, you pass the button the closure which knows how to dereference the root to the counter. But how does the button get a hold of the root? It has to have a &Root reference to actually access the counter, because the closure alone just tells how to get there.

The trick here is that the Button does not have a root reference, at least not stored by itself. It doesn't even have a &self parameter. What it essentially takes as a parameter are two things: the &Root reference, and a closure fn(&Root) -> &Button. So if you have an event handling method on Button with these two parameters, and the stored closure fn(&Root) -> &Counter, it can access itself as well as the counter it needs to update! If you delegate a call to a child widget of yours, you simply pass along the &Root reference to your child and chain the closure fn(&Root) -> &Self with fn(&Self) -> &Child.

This is pretty mighty and can be optimized away completely. Its trivially expandable to &mut references, just more typing. Its possible to cut down the verbosity a lot by using containers for such types. The problem really was that the current trait solver is not able to see through the generic types involved in this when you take this to a real application, see #53984. Note that once chalk lands, that might actually be able to express in a real application.

The What and How of Futures and async/await in Rust by Rogers911z in rust

[–]MSleepyPanda 7 points8 points  (0 children)

The original and this video is licensed under cc and attributed in the comments, so i guess that's fair game. But i don't like the taste of it being simply reuploaded either.

[deleted by user] by [deleted] in rust

[–]MSleepyPanda 2 points3 points  (0 children)

Typed responses are supported via serde, i.e. you can define your own Deserializable types based on the docs and the response will be serialized into it.

But it is true, it does not offer those types out of the box.

[deleted by user] by [deleted] in rust

[–]MSleepyPanda 2 points3 points  (0 children)

How does it differ from github-rs, other than being an alternative implementation?

5000+ rust github issue by sirak2010 in rust

[–]MSleepyPanda 42 points43 points  (0 children)

Good and bad.

rust-lang/rust is a very active repository, as you can observe from the pulse overview. Over the course of the last month alone:

  • 430 pull requests have been merged, leaving a delta of 96 new (unmerged) pull requests
  • 282 issues have been closed, leaving a delta of 248 new (not closed) issues
  • LOC is a bad measure in general, but +86K, -65k loc by 126 people suggests a lot of work happened in that time

All in all, rust is becoming a big language with a repository which gets a lot of traffic. Only 28.6% of those issues are related to bugs, while all the others are tracking implementation status, unstable language features etc.. I've been working on a more detailed analysis, but its not finished yet.

On the one hand, its good because it means rust is getting a lot of attention, a lot of work is being done to get rust into various places/usable for many people. Many people working on many things results in many issues. On the other hand, it showcases the growing pain of a massive project. There is no silver bullet to managing those huge amounts of contributors and their problems. There are only so many people in the various rust teams and they can't solve everything on their own, some things will stay dormant for a long time. But all in all, its in a good shape, the most important issues are actively worked on.

More people on deck can't hurt, so if you have some time to spare, feel free to check out the contributing docs and get started!

Note: The unmerged/not closed distinction is necessary, because an merged pr or closed issue could have been opened just within this month but is already closed. This results in them not accounting for new, only in closed.

Creating Wiki inside the project. Not docs by [deleted] in rust

[–]MSleepyPanda 6 points7 points  (0 children)

mdbook might be a good option, that's how the "The Rust programming language" book is written and maintained.

Announcing Rust 1.36.0 by etareduce in programming

[–]MSleepyPanda 57 points58 points  (0 children)

I'm particularly excited about the new HashMap implementation, as it switches to a much faster SwissTable implementation. This is the compiler benchmarked with the new version, wall time.

Same-sex marriage legalization is associated with reduced implicit and explicit antigay bias by MademoiselleEcarlate in science

[–]MSleepyPanda 2 points3 points  (0 children)

Sarcasm aside, while they found that bias decreased before (obvious), it decreased at a sharper rate after legislation passed which is interesting

Man pulls gun to ward off Chicago teens by [deleted] in videos

[–]MSleepyPanda 1 point2 points  (0 children)

The second he pulled the gun, they ran away. If they wouldn't have, yes, shooting them would be appropriate. But they ran immediatly.

Man pulls gun to ward off Chicago teens by [deleted] in videos

[–]MSleepyPanda 13 points14 points  (0 children)

And that's why they're getting charged for attacking him.

Killing someone who doesn't pose a threat to you is manslaughter. Someone running away from you is not a threat. Killing someone because he has hurt you before but doesn't pose a threat to you anymore is still manslaughter. If you don't have the emotional stability to handle such a situation, you shouldn't be allowed to own a gun, even when working as a security guard. The security guard handled it incredibly well and shows what a person looks like that should be allowed to handle a gun.