infoq, to rust
@infoq@techhub.social avatar

In this article, Vitaly Bragilevsky shares findings and insights about the Rust community and ecosystem, and discusses the peculiarities and pitfalls of starting new projects in or migrating from other languages.

Read now: https://bit.ly/3MFb9oH

flashmasterdash, to rust

Now that's a strange syntax for calling a method on a generic type, I guess 🤔 Or is it?

AstraKernel, to rust

🦀

What is the output?

A. it will not compile

B. It will panic

C. it will print
Mike
Drop the Mike
Mike
Drop the Mike

D. it will print
Mike
Mike
Drop the Mike

You can also vote your answers below 👇

rust_gamedev, to rust

🎉 3 starts on May 21! 🎉

The theme is going to be announced at the submission opening - you can use it, but it's optional since the jam only wants to get people to write games in Rust.

Details on itch: https://itch.io/jam/rusty-jam-3

rust_gamedev,

3 has concluded!

🥇Find Ferris
🥈Tug of Orb
🥉 The Veiled Path

This jam had few but high-quality and awesome games! We wish all the participants good luck in their future endeavors!

You can find the submissions here: https://itch.io/jam/rusty-jam-3/results

slomo, to rust

I was (and still am) looking into various Rust build integration issues over the last weeks, specifically when integrating Rust code into existing C code bases.

Today I ran into one that is very easy to fix, and that e.g. shaves off half of the shared library size from librsvg.

https://gitlab.gnome.org/GNOME/librsvg/-/issues/965

Distros might want to do this explicitly in their builds for now.

Make sure to always pass --gc-sections (or equivalent) to the linker when linking a Rust staticlib into an executable or shared library. And in case of the latter, also make sure to only exports the symbols you want to export (librsvg did that part correctly).

Apparently this was also not mentioned anywhere in the Rust docs, and from looking around there seem to be more projects that are not aware of this. So I also added a section about this to the Rust docs (well, reference).

https://github.com/rust-lang/reference/pull/1361

Unfortunately not all issues I ran into so far are that easy to fix 😅​

rustnl, to rust
@rustnl@fosstodon.org avatar

With the “Using to write modules” slides from @kushal added to the set, the RustNL 2023 presentations archive is now complete. https://github.com/rustnl/rustnl2023/tree/main/presentations

rafaelcaricio, to rust

I've spent a good part of my weekend working on upgrading the GStreamer Rust bindings on Servo. The presentation by Martin Robinson from @igalia at @rustnl was a real inspiration.

https://github.com/servo/media/pull/393

I'm delighted with the revival of Servo and I believe it has a bright future.

alexband, to rust

There have been quite a few requests for the slides of the RustNL 2023 presentations, so I've put them together in a folder in PDF format. #rust #rustlang #RustNL2023 https://github.com/rustnl/rustnl2023/tree/main/presentations

alightgoesout, to rust
@alightgoesout@holygrena.de avatar

I just published my first Rust :rust: crate: https://crates.io/crates/presage. I don't think anyone beside me will ever use it but I still felt very nervous 😬.

ianthetechie,
@ianthetechie@fosstodon.org avatar

@alightgoesout that’s pretty cool! I have written some CQRS systems in the past with Axon and wished it could have been in Rust.

alightgoesout,
@alightgoesout@holygrena.de avatar

@Aedius I guess it depends what you are putting in it and how your handlers rely on it.

itsfoss, to rust
@itsfoss@mastodon.social avatar

The final one in our Rust Basics Series is here!

https://itsfoss.com/milestone-rust-program/

jbzfn, to rust
@jbzfn@mastodon.social avatar

🦀 Build a desktop app with Qt and Rust
— LogRocket

https://blog.logrocket.com/build-desktop-app-qt-rust/

gee8sh, to rust

How do CPU/memory profile their applications?

gee8sh,

@janriemer Thank you Jan! I suppose support for Windows is limited on that front. Wondering if switching to WSL would do the trick. Will give it a go!

janriemer,

@gee8sh You're welcome. 🙂

Yes, unfortunately, I don't know any tools for Windows on that front.

I hope, WSL will work for you, though. 🤞

cxiao, to rust

In the new Rust Windows kernel GDI code, there is a new global allocator registered named gdi_alloc::Win32Allocator . It calls Win32AllocPool with a fun new pool tag name, "Rust"!

cxiao,

For the specific GDI objects, there are still allocations made with the existing GDI-specific pool tags.

It looks like the rgncore::scan::ScanBuilder<gdi_alloc::TaggedAllocator<_>> object uses the existing GDI pool tag Gscn ( i.e. GDITAG_SCAN_ARRAY) for vector allocations. (Probably gdi_alloc::TaggedAllocator<_> requires specifying a pool tag)

I also see Gedg (i.e. GDITAG_EDGE) being used in gdi_rust::region::from_path::GlobalEdgeTable::add_edge, and gdi_rust::region::from_path::ActiveEdgeTable::new
, among other places.

cxiao,

The Rust code in the new win32kbase_rs.sys in the Windows Kernel can also panic. What happens when it does?

There are several places where a panic is invoked in the code - they include bounds check failures (core::panicking::panic_bounds_check), indexing into a slice outside of the length of that slice (core::slice::index::slice_start_index_len_fail_rt), and assertion failures (core::panicking::assert_failed). These all eventually take a common code path through the following series of function calls:

core::panicking::panic_fmt::hd60a775b92204b91<br></br>-> rust_begin_unwind<br></br>--> seh_unwind::implementation::raise_exception::hc52a1220c03bdc19<br></br><br></br>

This calls into a custom panic handler, seh_unwind::implementation::raise_exception, which calls RtlRaiseException, imported from the main ntoskrnl binary!

gee8sh, to rust

... HELP! 😅

Maybe I need to unlearn some old OOP habits when working with but ... for the following code:

trait Bonus { ... }
trait A { ... }
trait B { ... }
impl<T: A> Bonus for T { ... }
impl<T: B> Bonus for T { ... }

I get the following Rust compiler error:

conflicting implementations of trait filters::Bonus [E0119]

Shouldn't I get this error only when I attempt to implement both traits A and B for some type T? As long as they're mutually exclusive, I am not sure I get why the compiler is complaining. How would you go about it?

gee8sh,

@daridrea Hmmm ... The intent of the code I shared is to say: if you implement either trait A or B, you get the Bonus trait for free. They're blanket implementations, much like the Into implementation which you get for free once you implement the From trait.

In my opinion, as long as there is no instance in the code where one type implements both A and B (directly or indirectly), then there should be no problem. But it seems the compiler is preemptively blocking this probably because it cannot prove the two traits are indeed mutually exclusive (but I don't get why it cannot prove that).

Something is still not clicking for me regarding some of the semantics of the language, but I am slowly getting there 🙂

gee8sh,

@daridrea indeed, I made things a bit more explicit by using wrapper structures and implementing the traits for those wrappers instead of implementing them for a generic type. This works for me now, albeit with a bit more verbosity. Thanks for your replies!

edward, to rust

I don't get why the default for is 4-space tabs. It's a pretty verbose language, so you'd think you want the extra horizontal room, no? I'm glad I can easily change it with rustfmt.toml though!

EyalL,
@EyalL@mastodon.social avatar

@ambihelical @AstraKernel @edward I wouldn't say they are poor because they don't invest in tab distinguishing.

We judge developers based on slightly more important traits 😂

So using only spaces frees up resources to deal with more important stuff

EyalL,
@EyalL@mastodon.social avatar

@ambihelical @AstraKernel @edward and as I said, all tab using projects I've seen everywhere, including the Linux kernel, end up with messy space and tab mixes

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • mdbf
  • ngwrru68w68
  • cubers
  • magazineikmin
  • thenastyranch
  • rosin
  • Durango
  • InstantRegret
  • Youngstown
  • slotface
  • khanakhh
  • kavyap
  • DreamBathrooms
  • provamag3
  • ethstaker
  • osvaldo12
  • tester
  • modclub
  • normalnudes
  • everett
  • GTA5RPClips
  • tacticalgear
  • Leos
  • anitta
  • megavids
  • cisconetworking
  • lostlight
  • All magazines