March 25, 2023
top rust frameworks
I examined various sources such as blog posts and Reddit discussions to gather information on Rust frameworks and libraries. These sources provided insights on frontend and backend web frameworks, GUI libraries, and RPC frameworks. There was a fair amount of consensus on some popular Rust frameworks and libraries, but opinions on their ease of use and suitability for specific projects varied. Some sources were more recent, while others were older, but still provided relevant information. Given my research, I have a good understanding of the popular Rust frameworks and libraries, but individual preferences and use cases may cause some variation in the recommendations.
Have an opinion? Send us proposed edits/additions and we may incorporate them into this article with credit.
Words
488
Time
2m 41s
Contributors
131
Words read
13.0k
Rust Frontend Web Frameworks and WebAssembly
Rust Backend Web Frameworks
"Rust provides various web frameworks for backend development, including a combination of tools, helpers, and libraries from different vendors that are each designed to provide a way to build, test, and run apps with efficiency, security, and flexibility."
"In this article, we will discuss what a web framework is and provide recommendations for which frameworks to use for Rust in frontend and backend development. Let’s get started."
Rust GUI Libraries
Rust RPC Frameworks
Jump to top
Research
"https://blog.logrocket.com/state-of-rust-gui-libraries/"
-Relevant GUI libraries for Rust programming language:
-Tauri
-open-source package that enables developers to create lightweight, web-based desktop applications
-cross-platform compatibility: can create a single GUI that can run on multiple platforms with minimal modification, resulting in a “build for one, run on all” scenario.
-fast
-event-driven architecture
-Druid
-powerful and flexible Rust library for building GUIs for desktop applications
-layout system allows for easy and intuitive widget layout based on constraints, making it easy to create visually consistent and responsive user interfaces.
-cross-platform compatible with support for Windows, macOS, and Linux
-comprehensive event-handling system
-Slint
-open-source, Rust-based UI framework for building native user interfaces
-support for multiple programming languages: Rust, C++, or JavaScript
-prebuilt UI components, like buttons, forms, modals
-customizable, so you can adapt them to the specific needs of your application
-responsive across different screen sizes
-cross-platform across different operating systems and processor architectures
-robust set of APIs for building custom components.
-gtk-rs
-safe Rust bindings for GNOME stack-based libraries like the GTK 3 and GTK 4 libraries
-cross-platform, object-oriented widget toolkit
-used for building portable GUI applications that work on Unix, Windows, and macOS systems in a number of languages
- provides GTK 3 and GTK 4 functionalities
-fltk-rs crate
-lightweight, cross-platform-supported toolkit for building GUIs
-supported on Windows, macOS, and UNIX systems
-more than 80 customizable widgets and more than four supported theme schemes, including the GTK scheme
-quick to install, build, start, and run with a single execution
-popular with more than 800 stars on GitHub
-iced
-renderer-agnostic, batteries included, data-centered cross-platform Rust library for building GUIs and frontends
-run on Windows, macOS, Linux, and the web (using the DOM) with a responsive layout
-due to its versatility, one of the most popular Rust libraries
-relm
-GTK-based, asynchronous GUI library inspired by the Elm Architecture
-build cross-platform GUIs using relm
-beta stage, might change rapidly
-
"https://blog.logrocket.com/top-rust-web-frameworks/"
- Rust is one of the most popular open-source programming languages for developers due to its high-performance, reliability, and fast features.
- A web framework is a software tool that supports web applications’ development. Web frameworks can be small codebases for micro-applications or large codebases for enterprise apps.
- The most extensive web frameworks provide libraries for databases, session, templating, migration, and other resources that boost the development process.
- Simplistic frameworks focus more acutely on frontend management for static content rendering.
- When choosing the appropriate web framework for your project, your development team should consider security, flexibility, community growth, project size, releases, documentation, and support.
- Rust provides frontend and backend web frameworks such as yew, Stdweb, Tauri, Smithy, Dioxus, Iced, Percy, Sauron, Rocket, Actix, Axum, warp, Gotham, Rouille, Thruster, Tide, and Dropshot.
- WebAssembly (Wasm) enables low-level language programming languages to operate in modern web browsers, including Rust.
- Rust uses a tool called wasm-pack to assemble and package crates that target Wasm.
- Stdweb, a frontend standard library, gives Rust the power to interact directly with JavaScript web APIs.
- Yew is an improved version of Stdweb, component-based, with support for multi-threading and similar features to Stdweb
- Percy is a toolkit for building single-page apps (SPAs) and managing UI for better structure, optimization, and bug fixes.
- Sauron is a micro frontend framework inspired by the Elm architecture. It has event support, state management, and components.
- Dioxus, a UI library, is built around a virtual DOM to support building cross-platform apps for the web, mobile, and desktop. It has component-based architecture, asynchronous, props for building proposals, an inbuilt error handler, and state management.
- Iced is a GUI library for cross-platform development. It offers Elm-style, reactive programming, inbuilt widgets, async, and the modular and reusable component-based architecture with simplicity, safety, and type safety.
- Tauri is a Rust library for building desktop applications with the integration of any frontend technology that renders HTML, CSS, and JavaScript into your web view for its UI.
- Rocket, a popular web framework, has support for testing libraries, cookies, templates, databases, ORMs, routes, boilerplates, and more.
- Actix, using Rust’s actor system, is
"Personal review for rust GUI frameworks"
- The author shares their experiences using various Rust GUI frameworks, including dioxus, slint, and egui.
- The author prefers dioxus because of its react-style architecture and the ability to create UI in pure Rust without writing HTML, JS, and CSS. The combination of dioxus, fermi, tailwindcss, and daisyui is recommended for creating a good-looking application.
- Other frameworks are mentioned such as slint, which provides a declarative UI language with LSP support and is actively developed but has an immature layout mechanism and some suboptimal controls.
- Egui is mentioned as a good option for creating simple tools, but font loading is manual, and things can become verbose for complex UI.
- The comments section provides additional insights, opinions, and clarifications to some terms used in the article.
- Some of the commenters express their own experiences with Rust frameworks such as Tauri and Iced.
- Tauri is mentioned as a Rust and web view based GUI framework that allows integration with JS libraries and has some performance bottlenecks.
- Iced is recommended by some commenters for its ease of use, but it still lacks IME integration and text shaping and font fallbacks.
- Some commenters also provide opinions and comparison with HTML, CSS, and JS-based frameworks and prefer single-language approaches.
- Zero dependencies mention by the author refers to the executable not requiring the user to install any other libraries to run, and package size refers to binary size.
- The author’s requirements for GUI frameworks include small package size, with zero dependencies, cross-platform support, cross-build support, and cross-platform IME integration and Unicode character support.
- The comment section provides a clarification of what IME integration means for supporting software keyboards for typing in Chinese and Japanese, among others.
- Screenshot links are included to show some examples of UI created using dioxus and slint.
- The author and some commenters have some concerns regarding some of the frameworks’ inactivity in development and potential for future viability.
- Some code snippets are provided to showcase how various Rust frameworks work.
- The article and comments provide a useful comparison of some of the Rust GUI frameworks available, their features, pros, and cons, and their usefulness for different use cases.
"Recommended Rust GUI Libraries"
- The Reddit post titled “Recommended Rust GUI Libraries” was posted a year and seven months before and has gained 148 points
- The Reddit post is asking for recommendations for Rust libraries that can be used to develop desktop GUI applications on an M1 Mac
-
A comment recommends using
egui
library if the developer does not require a native look as it is simple to use -
Another comment disagrees with the previous recommendation stating that
egui
may become painful when designing complicated and non-standard layouts, especially when creating resizable and responsive windows -
A third comment provides a possible solution to the layout problem of
egui
by using a bottom-to-top layout -
Another recommendation is to use the
iced
library with a link to an example application -
Several other comments express their admiration for the example application built using
iced
and that Rust GUI libraries have improved over time. A few comments provide mixed feedback abouticed's
CPU usage and compile time -
One comment suggests the
GTK
Rust bindings, which are powerful and should be multi-platform -
Another comment recommends
druid
as a very nice declarative framework to work with, with no idea how idiomatic it is since they are not experienced indruid
-
A Reddit user points out a website called
areweguiyet.com
which tracks the progress of various Rust GUI projects, showing which Rust GUI libraries are ready for production. The website is currently showing that several of the libraries are still experimental and should not be depended on yet. -
Users in the comments provide their mixed reviews of
druid
, with one recommending it for its intuitiveness, another disliking its long compile times, and the other stating that it has limited ability to render content on top of other content and has no ability to create multiple windows. - The Reddit post provides a glimpse of the challenges of creating good Rust GUI libraries, but several developments have been made to improve them over time.
"Which Rust RPC frameworks are the easiest to use?"
- User asks for advice in choosing a protocol for distributed DB and lists possibilities for client <-> server & server to server communication
- Frameworks mentioned include using bare Serde, Tarpc, JSONRPC, capnproto, and Tonic (and other GRPC libs)
- User seeks experience feedback with these frameworks
- User also asks whether just using serde_json and implementing their own request handlers would suffice
- Commenter reports success with Tonic and gRPC, and suggests that the minimal cognitive overhead of using an RPC framework is worth it
- Protobufs, used by gRPC, are very prevalent and commenter recommends their familiarization
- Cap’n Proto (de)serialization format offers performance improvements over Protobufs and could be a good option as well; commenter suggests Cap’n Proto and finds implementation with various languages and strict separation between interface and implementations advantages
- Tonic and gRPC and Cap’n Proto offer support for streaming in both directions
- A commenter suggests using Tarpc for implementation
- Issues with Cap’n Proto and multi-threading reported; commenter finds local_spawn to work in async std, but most of the capnp types aren’t send so async std is recommended instead of tokio for capnp.
- Another commenter suggests querying capnp(rust)
- Request for tutorial on capnp(rust)
- One commenter prefers tarpc for implementation
- Discussion spans two years
💭 Looking into
Comparison of major Rust GUI frameworks and their corresponding use-cases
💭 Looking into
3 most widely used Rust web frameworks and their key features