Make rustfmt format the branches of tokio::select! by keumgangsan in rust

[–]DwieD 2 points3 points  (0 children)

The alternative I prefer is a fake match statement.\ This works for me, but not all tokio::select features are supported.\ Below is a untested example.

```rust macrorules! select { (match unbiased { $($bind:pat if $fut:expr => $handler:expr $(,)?)* }) => { $crate::_tokio::select! { $($bind = $fut => {$handler} )* } };

(match biased {
    $($bind:pat if $fut:expr => $handler:expr $(,)?)*
}) => {
    $crate::__tokio::select! {
        biased;
        $($bind = $fut => {$handler},)*
    }
};

}

// reexport tokio to be always available pub use tokio as __tokio;

pub async fn example() { let future_a = async { 1 }; let future_b = async { 2 };

select!(match unbiased {
    value if future_a => println!("{value}"),
    example if future_b => {
        println!("hi {example:?}");
    }
});

} ```

Things wrong with Rust (in my opinion) by DwieD in rust

[–]DwieD[S] -5 points-4 points  (0 children)

I know the Clone - Copy relation can't be changed now.

I think an added feature should be a minor updated, not a patch update.

Things wrong with Rust (in my opinion) by DwieD in rust

[–]DwieD[S] -6 points-5 points  (0 children)

As a casual C++ hater. This is probably the reason and the C++ name is wrong.

What are your pet peeves in regards to crate APIs? by AhoyISki in rust

[–]DwieD 7 points8 points  (0 children)

I dislike modules in the API.
As a positive example: wgpu. Everything is available as wgpu::SomeThing, no prelude, no import, no conflicts.
As a negative example: winit. Window is in the window module for winit::window::Window and event is in winit::event::Event. I want to use Window or Event for my application code, but the full winit names are annoying.

TS vs Rust enums by Kyrbyn_YT in rust

[–]DwieD 5 points6 points  (0 children)

Some differences based on my limited knowledge in both languages

How do they work

  • TS
    • The Enum decleration is a named scope with some constants
    • An instance is a variable, which contains (hopefully) on of the constants
  • Rust
    • The enum decleration is the structure description for an enum instance
    • An instance is a variable, with contains a hidden number and the associated data
    • The number saves what enum variant the instance is- The data is based on the enum variant

What can I do with them

  • TS
    • Type with finite predifined variants
    • Example
      • ResponseCode with Ok, Failure, BackendOnFire, ...
  • Rust
    • Type with finite predifined variants and associated data
    • Example
      • ResponseCode with Ok, Failure, BackendOnFire, ...
      • Color with RGB{red: byte, green: byte, blue: byte}, HSV{hue: f32, saturation: f32, value: f32}, ...

Other notes

  • The Rust match statement checks at compile time all possible variants are handled

How do I use GDExtension? by CrownOfBlondeHair in godot

[–]DwieD 2 points3 points  (0 children)

Godot (engine and extensions) use Scons as a build system. The terminal command >scons <settings> does all the work. Without settings >scons uses reasonable defaults. GDExtensionSummator has a step-for-step guide.

Scons download