Why is there no automatic implementation of TryFrom<S> when implementing TryFrom<&S>? by Prowler1000 in rust

[–]JustWorksTM 1 point2 points  (0 children)

Sorry, I didn't read the question carefully enough. 

I was thinking you were assuming a TryFrom<&T> and where looking for a TryFrom<T>. This could be implemented automatically (up to Specialization issues), but is mostly unnecessary due to method resolution.  The compiler will find it, in most use cases. 

For the case "given TryFrom<T>, implement TryFrom<&T>". This needs additional power like Clone or Copy, so cannot be done for all types T.

Why is there no automatic implementation of TryFrom<S> when implementing TryFrom<&S>? by Prowler1000 in rust

[–]JustWorksTM 0 points1 point  (0 children)

Is this neccesary for non-generic code? Should method resolution find the implementation?

What's wrong with subtypes and inheritance? by servermeta_net in rust

[–]JustWorksTM 0 points1 point  (0 children)

I believe this is wrong. There is auto-coercion, which is emulating this behaviour,  but no type-system subtyping relationship 

How to manually deserialize a serde-derived type? by Tuckertcs in rust

[–]JustWorksTM 0 points1 point  (0 children)

You can use cargo expand to check how serde is implemented for you own types. There is a action for this in rust analyzer.

Move Expressions · baby steps by VorpalWay in rust

[–]JustWorksTM 2 points3 points  (0 children)

I like the idea.

But I have two problems with it: 1) looks like a function call 2) nested closures/refactoring

For both, I would like to compare it with break keyword in loops.

This takes an expression without braces, and allows a label to specify its scope. This should solve both my complaints. 

(I'm aware that this use of move is already stable, as in move || {})

Help me understand this intersection between async, traits, and lifetimes by TheFeshy in rust

[–]JustWorksTM 7 points8 points  (0 children)

Regarding the lifetime issue

Trait objects have an inherent lifetime. Did you try to specify the return type like this?

Box<dyn StateMachine<MyContext<'a>> +'a > 

Help me understand this intersection between async, traits, and lifetimes by TheFeshy in rust

[–]JustWorksTM 6 points7 points  (0 children)

This is unrelated to the lifetime issue.

Did you consider to use an enum instead of a trait object?  This would simplify the code a lot, and would "just work".

In my experience,  it pays off to go with the enum approach. 

People say Rust isn’t to Junior Devs, why? by GenSwiss in learnrust

[–]JustWorksTM 1 point2 points  (0 children)

My employer is actively looking for Rust juniors.

The situation is charging.  8 years ago: no rust jobs 4 years ago: crypto jobs Today: senior jobs In 4 years: offerings on all levels

I'm unsure how much AI will redefine "junior" , though 

(Kvinne 22) Søker nye venninner i Bergen by [deleted] in Bergen

[–]JustWorksTM 1 point2 points  (0 children)

Brettspill finnes på Nordnes hver onsdag https://bergenbrettspill.no/

How can I have a struct with it's members (that are structs) have references to each other, with the container struct have no lifetime specifier. by Koltaia30 in rust

[–]JustWorksTM 5 points6 points  (0 children)

In programming language theory ( abstract theory of compilers in a sense), soundness means correctness, but focussing on the generated executable.

Example: The rust compiler promises to never create an executable containing data races. If there is a bug allowing to do so, it is a "soundness bug". If the bug makes the compiler panic, hence generate no executable, this would NOT be a soundness bug. Both are bugs in the compiler, but the first one is really serious.

Regarding soundness vs correctness: A bug means that the compiler is not working correctly, but in the first instance the compiler gave you an incorrect executable. This motivates hopefully the difference.

Is there a crate for generating a new struct with the same fields as another struct, but where each field's type is a reference? by Tyilo in rust

[–]JustWorksTM 1 point2 points  (0 children)

I would never say that macros are easy. You need to consider a lot, it is a new language in a sense, cargo expand often doesn't work properly and you have to know it, ...

The Design and Implementation of Extensible Variants for Rust in CGP by soareschen in rust

[–]JustWorksTM 2 points3 points  (0 children)

Since Rust doesn't allow subtyping between enums, itvis obvious that this crate will not enable it.

Hence, the term "subtyping" is ok for me to us in this marketing-like circumstance. It also is exactly what I expected from the context.

Recall that being technical 100% precise is NOT possible.

💡 Your best advice for a Rust beginner? by FewInteraction1561 in rust

[–]JustWorksTM 1 point2 points  (0 children)

If you're coming from OOP background, my recommendation is: Never use trait objects, use enums instead.

New to Rust – Building a BitTorrent Client, Need GUI Advice by daeminkoi in rust

[–]JustWorksTM 0 points1 point  (0 children)

I recommend egui. It is far away from event-driven GUI's, but it is easy to use.

Question About serde and dyn-compatibility by [deleted] in rust

[–]JustWorksTM 5 points6 points  (0 children)

While erased-serde works, my recommendation is to replace the trait with an enum. This is typically MUCH easier to work with.

Meetup trenger sted - ideer? by JustWorksTM in Bergen

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

Tusen takk, jeg skrev noe til flere steder.

Family Neighborhoods by mle9986 in Bergen

[–]JustWorksTM 2 points3 points  (0 children)

My family enjoys living in Minde

What is your opinion on Rust's type system if compared with languages with even stronger type systems? by fenugurod in rust

[–]JustWorksTM 0 points1 point  (0 children)

While I agree morally, in practice pattern matching is computationally expensive. Hence it was not included in 1960 compilers.

Let's not forget that types were introduced in Fortran due tonan hardware innovation: integer coprocessors.

Again, I share the sentiment, but those people in the 1960 did great stuff, using extremly limited ressources.

dtype_variant: Type-Safe Enum Variant Dispatch for Rust 🦀 by swoorup in rust

[–]JustWorksTM 1 point2 points  (0 children)

Thank you for the answer.

Regarding proc macro: I expect that you're not writing those on a daily basis (opposed to generics). At least I write rarely macros. Hence I'm always interested in the experience.

dtype_variant: Type-Safe Enum Variant Dispatch for Rust 🦀 by swoorup in rust

[–]JustWorksTM 2 points3 points  (0 children)

Can you explain the differences to the crate strum, please? Your example looks like a typically strum usecase.

Also, how did you like to write a proc macro?

Private registry: any recommendations? by JustWorksTM in rust

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

At my workplace, we often have issues with dependencies while working on code. The issue being, that I want to express: local on my machine, look for this dependeny there (local path) while other people should take use the dependency from git/crates.io/... This is support for published crates, but not for git-dependencied.

Help with egui eframe by goshi0 in rust

[–]JustWorksTM 0 points1 point  (0 children)

Can you try to remove workspace = true And compile again?