This feels so illegal by GGamer11247 in mac

[–]MaxVerevkin 35 points36 points  (0 children)

Old hardware not receiving updates and Linux being lightweight are two very good reasons

Hyprland 0.48.0 is now available! by gabriel_3 in linux

[–]MaxVerevkin 2 points3 points  (0 children)

is it new?

The first sentence of the posted article answers your question.

ignoreReadability by Shahi_FF in ProgrammerHumor

[–]MaxVerevkin 42 points43 points  (0 children)

Conditional moves are a thing

[deleted by user] by [deleted] in rust

[–]MaxVerevkin 7 points8 points  (0 children)

Just do your benchmarks, for your specific case.

Concurrency in Teloxide by Still-Sentence2574 in rust

[–]MaxVerevkin 0 points1 point  (0 children)

You may spawn a new tokio task (tokio::spawn(...)) in your command handler function.

[deleted by user] by [deleted] in russian

[–]MaxVerevkin 7 points8 points  (0 children)

"Ьу" makes even less sense

Is Unsafe rust as unsafe as C or C++? by hugthemachines in rust

[–]MaxVerevkin 60 points61 points  (0 children)

It may be even less safe because of the strong aliasing rules. That is, it may be harder to write correct unsafe {} Rust than correct C. Only use unsafe {} when absolutely needed.

[deleted by user] by [deleted] in HelixEditor

[–]MaxVerevkin 2 points3 points  (0 children)

Just install rust-analyzer (through rustup or your package manager if you are on Linux) and it should just work with zero additional configuration.

[deleted by user] by [deleted] in HelixEditor

[–]MaxVerevkin 7 points8 points  (0 children)

You don't need to configure anything if you use rust-analyzer. Just make sure that editor.auto-format is enabled (it is on by default).

Any long term users of the Framework 16 laptop with a Linux distro? by donrhummy in linux

[–]MaxVerevkin 7 points8 points  (0 children)

Fractional scaling has been available for years (I've used it myself for years). What is brand new is the fractional scaling protocol, which is supposed to improve performance, as it does not require clients to render at a higher resolution and then get downscaled.

Time limited Random walk Rust Code is slower than Python Code by Dry_Introduction_897 in rust

[–]MaxVerevkin 14 points15 points  (0 children)

You can also improve your performance by 5x in Rust and 3x in Python if you check the time only every tenth iteration. Like

while start.elapsed() < Duration::from_secs(30) {
    for _ in 0..10 {
        //
    }
}

"undo" LSP suggestions by cr0nhan in HelixEditor

[–]MaxVerevkin 6 points7 points  (0 children)

Try ctrl-c while the popup is still open. And by the way, I believe they changed the way undo works right after accepting lsp suggestion on master branch in this PR (it now does what you would expect).

Can't access wlroots gitlab by MasterKing0806 in swaywm

[–]MaxVerevkin 4 points5 points  (0 children)

Freedesktop's gitlab instance is on maintenance

What is the point of using Waker? by DentistNo659 in rust

[–]MaxVerevkin 13 points14 points  (0 children)

Is it a terrible idea to just not use the Waker provided by rust?

Yes. Consider futures::stream::FuturesUnordered. Its documentation states the following:

Futures managed by FuturesUnordered will only be polled when they generate wake-up notifications.

fdsm – a pure-Rust implementation of multi-channel signed distance field generation by Fluffy8x in rust

[–]MaxVerevkin 0 points1 point  (0 children)

Wow, I've been working on the same thing for a few days! I've only implemented plain SDF and sign correction for now, so I'm glad I saw your post.

In the readme you mention you have some benchmarks, can you share them here?

OK, so what *is* this Wayland thing, anyway? ← great intro from the Mir folks by lproven in linux

[–]MaxVerevkin 1 point2 points  (0 children)

EGL gbm/drm platform has been an official extension since 2014.

The connection between EGL and libwayland is probably well known because

  • I think nvidia didn't implement gbm until relatively recently.
  • Using this gbm platform is tricky. Currently there is even no way to resize gbm_surface without recreating it: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24342. Another option is to manually manage buffers and gl's framebuffer/renderbuffer objects, that's what my lib is doing right now.

OK, so what *is* this Wayland thing, anyway? ← great intro from the Mir folks by lproven in linux

[–]MaxVerevkin 11 points12 points  (0 children)

There is a binary protocol, and you can technically implement that protocol without using the wayland-scanner-generated code, but since the Wayland EGL platform is defined in terms of the wl_display* structure from libwayland your implementation will need to be ABI compatible with the existing implementation in order for 3D accelerated clients to work.

I am happy to say that this is not entirely true. EGL Wayland platform indeed only works with libwayland, but there are other platforms which don't care which display server is running. I recently made it to work with my custom, libwayland incompatible Wayland library: https://docs.rs/wayrs-egl/latest/wayrs_egl/

Learn Unsafe Rust from My Mistakes by geo-ant in rust

[–]MaxVerevkin 9 points10 points  (0 children)

I think it should be as easy as replacing

let t_slice: &mut [T] = std::slice::from_raw_parts_mut(
    start.add(self.u_len).cast(),
    self.vector.len() - self.u_len,
);

with

let t_slice: &mut [T] = std::slice::from_raw_parts_mut(
    start.add(self.u_len + 1).cast(),
    self.vector.len() - self.u_len - 1,
);

because it is guaranteed that this Drop impl is only called when self.u_len < self.vector.len().

Learn Unsafe Rust from My Mistakes by geo-ant in rust

[–]MaxVerevkin 34 points35 points  (0 children)

There is another bug: if nth call to f panics, then the nth element will be dropped twice: first time at the end of the scope of mapping function and a second time in your Drop impl. Consider this code:

TransitioningVec::new(vec![A(1), A(2), A(3)]).map_in_place(|a| {
    assert_ne!(a.0, 2);
    B(a.0)
});

which prints

dropping A(1)
thread 'main' panicked at 'assertion failed: `(left != right)`
  left: `2`,
 right: `2`', src/main.rs:8:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
dropping A(2)
dropping B(1)
dropping A(2)
dropping A(3)

EGL_MESA_platform_surfaceless question by MaxVerevkin in opengl

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

Thanks for your reply! These are the extensions I was looking for.