What is an idiomatic rust equivalent of C# events?

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • winsafe

    Windows API and GUI in safe, idiomatic Rust.

    Internally, these closures are simply stored as FnMut in a Vec, exactly here, to be retrieved and called when the event itself happens.

  • bus

    Efficient, lock-free, bounded Rust broadcast channel

    I would say channels. In this case, a single producer, multiple consumer (spmc) broadcast channel, like bus. I can't vouch for this library, but it seems to do what you're looking for

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • winsafe-examples

    Examples of native Windows applications written in Rust with WinSafe.

    For example, a button click, where self.wnd is the parent window, looks like this:

  • winlamb

    A lightweight modern C++11 library for Win32 API, using lambdas to handle Windows messages.

    I used this pattern in my C++ lib, and I just translated it to Rust idioms. The trickiest part is working under Rust's ownership system – the borrow checker is really unforgiving.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts