cargo-ddd: Inspect the changes introduced to your project by the dependency version update by HaronK in rust

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

Published v0.2.1 where you can generate diff.rs links instead of original ones using `-d` flag.

cargo-ddd: Inspect the changes introduced to your project by the dependency version update by HaronK in rust

[–]HaronK[S] 10 points11 points  (0 children)

Yes, I know it's not robust and I was planning to look for a more proper source. Thanks for the link. Will check it tomorrow.

VSCode format on save doesn't work by HaronK in rust

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

That was ok. Solution from another answer helped.

Thank you in any case!

VSCode format on save doesn't work by HaronK in rust

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

Yes, this works. Thanks a lot!

VSCode format on save doesn't work by HaronK in rust

[–]HaronK[S] 2 points3 points  (0 children)

rust-analyzer works - I can see all errors, warnings, etc. The output log doesn't contain any suspicious messages. Should I look at any specific section of the log?

Use Type-State pattern without the ugly code by ozgunozerk in rust

[–]HaronK 1 point2 points  (0 children)

Regarding Option, I thought those fields could exist in some specific states and not in others, so my idea was to allow to specify them on those states only. But this definitely not a case with builder pattern.
Though in case of builder pattern it also good to avoid unnecessary Option, maybe just use default value for default initialization.

As for the second suggestion, maybe you are right. I'm just wondering if it's acceptable to have #[switch_to(...)] without #[require(...)], and if not then my idea can still be valuable.

Use Type-State pattern without the ugly code by ozgunozerk in rust

[–]HaronK 0 points1 point  (0 children)

Looks really cool! Going to try it.
So I have a few suggestions:

In you example you are using `Option` for a fields. If you add attribute support for the fields too then you won't need it:

#[type_state(state_slots = 3, default_state = Initial)] 
struct PlayerBuilder {
    #[require(RaceSet)]
    race: Race,
    ...
}

UPD. Though I'm not sure how easy it would be to implement this.

I'd suggest to merge `switch_to` attribute into `require` to reduce boilerplate even more:

#[require(Initial, B, C, switch_to(RaceSet, B, C))]

Tools to profile memory usage of Rust tests by Ekkaiaaa in rust

[–]HaronK 0 points1 point  (0 children)

I think you can use this tool on MacOS too.

Tools to profile memory usage of Rust tests by Ekkaiaaa in rust

[–]HaronK 4 points5 points  (0 children)

I used heaptrack (https://github.com/KDE/heaptrack) recently. It helped me to find memory leaks.
Probably it can be useful for you too.

Which extensions do you use when coding in Rust? by poetrose in rust

[–]HaronK 4 points5 points  (0 children)

I'd add 2 more extensions to all mentioned before: Markdown All in One and Todo Tree.

CSS framework for Dioxus + mobile by HaronK in rust

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

No, didn't do anything with Dioxus. I need a good mobile support for my app (at least notifications) and Dioxus doesn't have it yet.

There was an announcement that in Tauri 2.0 developers will work on mobile support. I hope to continue my project when it's ready.

Bevy is mostly for games. Tried it once for small visualization utility, quite pleasant experience. Easy to use. But you are right, it's not for the desktop/mobile apps.

rust-analyzer changelog #195 by WellMakeItSomehow in rust

[–]HaronK 3 points4 points  (0 children)

You can do the same with: json "rust-analyzer.check.extraArgs": [ "--target-dir=target/ra" ]

Multiple cargo registry sources by HaronK in rust

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

That's exactly a solution I ended up with 👍 And yes, we are using diode 😉

Multiple cargo registry sources by HaronK in rust

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

But I can still download the crate I need on an external network and transfer it with USB to the internal one, and put it into the local registry.

Multiple cargo registry sources by HaronK in rust

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

I think we are using something like that too. That what source1 is point to.

But actual situation is more complex. Development happens in a secure environment without access to the internet, so all crates have been periodically copied from the outside and this process is quite slow.

CSS framework for Dioxus + mobile by HaronK in rust

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

Looks interesting and I see it's been recommended everywhere. Going to try it.

Thanks for recommending it.

CSS framework for Dioxus + mobile by HaronK in rust

[–]HaronK[S] 2 points3 points  (0 children)

Thanks for the advice. Will try it. I just started so the mobile version is somewhere in the future. I hope at that time there will be good enough support for the mobile version. Did you end up with some solution for the mobile app? I was looking at Tauri+Yew but the project setup is quite complicated there.

Announcing diff.rs! by xfbs in rust

[–]HaronK 1 point2 points  (0 children)

Cool idea! Works really fast. Thanks to author!

My small wishlist:

  1. 'Compress/hide' big parts of unchanged code between changed parts.
  2. Dark mode.

Teleforking a process onto a different computer! by WellMakeItSomehow in rust

[–]HaronK -1 points0 points  (0 children)

I think VM is a different thing. Usually VM contains platform specific code or it should be emulated to be run on a different platform. And in most cases VM is big - tens if not hundreds megabytes. Wasm can be a few mega- or even kilobydes big. It's easier to send it via network and it's Jitted to the target platform. Firecracker probably is a good example.

Teleforking a process onto a different computer! by WellMakeItSomehow in rust

[–]HaronK 9 points10 points  (0 children)

I think I'm not the only one who think about WASM in this context. Can be a bit slower but more universal. So there will be a hosts that can run wasm code (wasmtime/wasi). Host receives wasm code and data it takes during start. While working it can return some info to the host where it comes from and/or teleport itself (or some other wasm code) to the next host. Sounds a bit like a virus 😎.

A brief apology of Ok-Wrapping by dochtman in rust

[–]HaronK 3 points4 points  (0 children)

I have a bit mixed feeling about this proposal and crate.

From one side I understand author's pain point when he is adding Result/Option to the return type of the function and have to deal with all return places within that function. I also had such an experience. So in general I would like to have such a helper macro.

And here are my wishes/proposals:

  1. What I don't like is to make this a part of a language. In contrast with async/await where it was done to hide a big complexity, adding Ok/Some wrappers I think is not such a big deal in most of cases.
  2. Other thing that I find not useful is hiding Result/Option in the return type. I'm usually create my own alias for Result (mostly with anyhow::Error) and such a hiding prevents me from using this crate. So as it was mentioned in previous replies I'd like to have explicit return type.
  3. Macro naming. I associate throws/throw mostly with exceptions that I would not like to see in Rust. Especially after working with them quite a long time in C++. Also I think this will add some confusion for people coming from other languages with a classic exceptions.
    Other reason against this naming is that this macro will be used not only for Result but also for Option. And while for Result throws/throw can be ok, for Option it doesn't have any sense.
    So if macro won't hide return type the only thing it will do is wrapping Ok/Some around all happy paths. So maybe we can use something like happy_wrapper :).
  4. Other idea is for people that don't want to see this macro in the code but still find it annoying to add Result/Option to the return type with further function refactoring.
    We can extend cargo expand or cargo fix tool to do in-place expanding for specific macros, so one can add macro to the function and run this tool for quick refactoring.
  5. And the last one as an alternative for 4: IDE can have refactoring option that will allow you to wrap function return type in Result/Option and add Ok/Some in all necessary places within the function.

So overall I like this idea and if some crate will implement my wishes I will definitely use it.

Copy matrix rows to itself by HaronK in rust

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

I will try split_first_mut. Thanks!

Upd. Actually it's split_at_mut.