By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: A JVM Engineer’s First Real Rust Project | HackerNoon
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > Computing > A JVM Engineer’s First Real Rust Project | HackerNoon
Computing

A JVM Engineer’s First Real Rust Project | HackerNoon

News Room
Last updated: 2025/11/28 at 7:03 AM
News Room Published 28 November 2025
Share
A JVM Engineer’s First Real Rust Project | HackerNoon
SHARE

I have been learning Rust for a couple of years, and using it for pet projects and demos alike. But the company I work for is heavily invested in the JVM ecosystem, so I genuinely thought I’d be writing Java and Kotlin forever. However, last week, I had a nice surprise: I convinced my management that using Rust for a particular project was the right choice. It’s not a huge project, but I want to describe my experience using Rust in a “real” project.

The project

Our main software platform has baked-in health sensors for monitoring. These sensors are exposed as HTTP APIs. The problem is that most customers do not actively monitor those endpoints. For an engineer such as myself, they are responsible for their lack of maturity regarding observability; for customer success managers, they should be helped and cared for.

The goal is simple: provide a component that polls the sensors’ state and sends them via email. One can configure the sensors polled and the severity, e.g., warning and above, as well as the email and a a few other parameters.

Why Rust?

While I like Rust a lot, I also love Kotlin, would like to practice Gleam on Beam, etc. There are objective reasons to use Rust for this project, and they are tied to the context and solution design.

The first thing I had to advocate for was to design the component outside the platform. People want to put everything inside it. When all you have is a hammer, then everything looks like a nail. Yet, if the platform is already crashing, then chances are the reporting component will be unavailable.

Once it was agreed, the component’s tech stack became independent of the platform’s. It was time to challenge another widespread Pavlovian reflex. When I was asked to schedule tasks in a JVM application, my go-to solution was Quartz.

Quartz is a richly featured, open source job scheduling library that can be integrated within virtually any Java application – from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens of thousands of jobs; jobs whose tasks are defined as standard Java components that may execute virtually anything you may program them to do. The Quartz Scheduler includes many enterprise-class features, such as support for JTA transactions and clustering.

— What is the Quartz Job Scheduling Library?

It worked, it works, and it will work. However, it requires the application to keep running, as in web apps, for example. What happens if the application crashes? How will it restart? Quartz doesn’t answer these questions.

With experience, I have changed my approach. I prefer now to run to completion and use the operating system scheduler, e.g., cron. It’s the application of the single responsibility principle: both the application and cron do their job and only theirs. It renders the application smaller and the overall solution more resilient.

The JVM benefits long-lived applications, whose performance it can improve over time. Within the context of a short-lived process running to completion, it’s not a great fit: it will consume a lot of memory, and before it has started compiling the bytecode to native code, the application will have ended. At this point, I had two alternatives: Go or Rust. I hate Go, more specifically, its error handling approach, or even more specifically, its lack of proper error handling.

Different customers will use different operating systems. Rust allows cross-platform compiling:

Rust supports a great number of platforms. For many of these platforms The Rust Project publishes binary releases of the standard library, and for some the full compiler. rustup gives easy access to all of them.

When you first install a toolchain, rustup installs only the standard library for your host platform – that is, the architecture and operating system you are presently running. To compile to other platforms you must install other target platforms.

— Cross-compilation

The above arguments helped me convince my management that Rust was the right choice.

Choosing crates

Crates are either libraries or applications in Rust. For the sake of simplicity, I’ll use the term “crate” instead of “library crate” in this post.

Java became 30 this year. The ecosystem had time to grow, evolve, and solidify. Moreover, I started very early in the game. When I need a dependency on the JVM, I have my catalog ready. Rust is more recent, and I don’t have as much experience with it. In this section, I want to explain my choice of crates.

  • HTTP requests: I need TLS, to add request headers, and to deserialize the response body. I successfully used reqwest in the past. It fulfils each of the above requirements. Check!

  • Configuration: The component requires several configuration parameters, for example, the list of sensors to query and the credentials to authenticate on the platform. The former is structured configuration; the latter is considered secret. Hence, I want to offer multiple configuration options: a configuration file and environment variables. For this, the config crate fits the bill.

  • SMTP: While I had the two previous crates already on my list, I never sent mail in Rust before. A cursory search revealed the lettre crate:

Lettre is an email library that allows creating and sending messages. It provides:

  • An easy-to-use email builder

  • Pluggable email transports

  • Unicode support

  • Secure defaults

  • Async support

— Crate lettre on doc.rs

lettre does the job, although it brings along a lot of dependencies (see below).

  • Other crates of interest:
  • serde for JSON deserialization
  • strum for everything around enum, including JSON deserialization
  • anyhow for exception handling. For more information, check Error management in Rust, and libs that support it.
  • chrono for date and time management
  • log and env_logger for logging

Macros for the win

None of the programming languages I know have macros. In Java, you do meta-programming with reflection, with the help of annotations. Macros are the Rust way to achieve the same, but at compile time.

For example, I wanted to order the sensor results by severity descending before emailing them. Programming languages generally offer two ways to order a Vec: by natural order and with a dedicated comparator. Rust is no different. In my case, it stands to reason to use the natural order, since I probably won’t compare them any other way. For that, Severity must implement the Ord trait:

pub trait Ord: Eq + PartialOrd {
   // Required method
   fn cmp(&self, other: &Self) -> Ordering;

   // Provided methods
   fn max(self, other: Self) -> Self
      where Self: Sized { ... }
   fn min(self, other: Self) -> Self
      where Self: Sized { ... }
   fn clamp(self, min: Self, max: Self) -> Self
      where Self: Sized { ... }
}

— Trait Ord

If you think you only need to implement cmp, you’re mistaken. Ord requires both Eq and PartialOrd, whose functions you also need to implement. The whole trait tree is:

While it’s possible to implement a couple of functions for the Severity enum, most of it can be inferred: an enum is only equal to itself, and its order is its declaration order. The derive macro does exactly this. With the help of the strumcrate, I can implement the above as: n

#[derive(PartialEq, Eq, PartialOrd, Ord)]
enum Severity {
    // Declare levels
}

I also need to display, clone, and use the Severity as a key in a HashMap. The full declaration is: n

#[derive(Debug, Display, Deserialize, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash)]
enum Severity {
    // Declare levels
}

Compilation on Windows

I was living the dream, until I added the letter crate. At this point, Rust stopped compiling, citing a linker issue with too many symbols. I first tried to set default_features = false to as many crates as possible; I still hit the limit, albeit a bit later. Rust was still able to compile in --release mode, because it aggressively optimizes code. Yet, I couldn’t just keep developing in release mode only; breakpoints are foundational when debugging. I started to search.

It turns out that the default Rust toolchain on Windows uses Microsoft Visual C++, and it was the culprit. The alternative is to use the GNU toolchain, i.e., x86_64-pc-windows-gnu. You need to install MSYS2:

MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software.

rustc complains if it doesn’t find the required commands. Install them with MSYS2.

I can’t write down in detail, because:

  • I went back and forth
  • I didn’t think about taking notes on my journey; I focused on making things work instead
  • The project is on my work laptop

Anyway, I hope it will be enough to help those who find themselves in the same situation.

Conclusion

This project has been a great opportunity. On one hand, it confirmed that my Rust skills were adequate for a simple component. On the other hand, I could deepen my knowledge of library crates. Finally, I managed to get acquainted with Rust on Windows.

To go further:

  • Cross-compilation
  • rustup overrides
  • reqwest crate
  • config crate
  • letter crate

:::info
Originally published at A Java Geek on November 23rd, 2025

:::

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article Authenticity Over Convention: Lessons from 16 Years of Solo Game Development Authenticity Over Convention: Lessons from 16 Years of Solo Game Development
Next Article PSA: Apple’s Podcasts App Could Be Enabling Malicious Content Delivery PSA: Apple’s Podcasts App Could Be Enabling Malicious Content Delivery
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

Branch’s Black Friday Sale of the Year Brings Great Discounts to Our Favorite Home Office Gear
Branch’s Black Friday Sale of the Year Brings Great Discounts to Our Favorite Home Office Gear
Gadget
Best Buy’s Black Friday Sale Is Here. Our Experts Found the Best Deals on Apple iPads, LG TVs, Motorola Phones, and More
Best Buy’s Black Friday Sale Is Here. Our Experts Found the Best Deals on Apple iPads, LG TVs, Motorola Phones, and More
News
NTFSPLUS Now Supports $MFT File Extension, FITRIM, More Mount Options
NTFSPLUS Now Supports $MFT File Extension, FITRIM, More Mount Options
Computing
Best Black Friday DJI deal: Save  on the DJI Mic Mini at Amazon
Best Black Friday DJI deal: Save $90 on the DJI Mic Mini at Amazon
News

You Might also Like

NTFSPLUS Now Supports $MFT File Extension, FITRIM, More Mount Options
Computing

NTFSPLUS Now Supports $MFT File Extension, FITRIM, More Mount Options

3 Min Read
One Identity Safeguard Named a Visionary In The 2025 Gartner Magic Quadrant For PAM | HackerNoon
Computing

One Identity Safeguard Named a Visionary In The 2025 Gartner Magic Quadrant For PAM | HackerNoon

5 Min Read
Why Organizations Are Turning to RPAM
Computing

Why Organizations Are Turning to RPAM

6 Min Read
AMD ISP4 Linux Webcam Driver Updated For HP ZBook Ultra G1a & Future Ryzen Laptops
Computing

AMD ISP4 Linux Webcam Driver Updated For HP ZBook Ultra G1a & Future Ryzen Laptops

6 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?