Home » Ruby

Ruby

Creating a Rusty Rocket fuelled with Diesel

Sorry if that title seemed stupid. The super serious title would be “Creating a REST API in Rust using Rocket and Diesel”, but that’s boring. Anyway… Here I go with my first post that fully focuses on Rust. After spending a few months doing a bit here and there I decided to just dive right in as I was going ...

Read More »

Using Genetic Algorithms in Ruby

Did you know that there’s a way to use the power of natural selection to solve programming challenges? With genetic algorithms (GA), you can solve optimization problems using the same concepts that you find in nature: Reproduction Survival of the fittest Adaptation to the environment So what’s an optimization problem? It’s when you want to find not just a valid ...

Read More »

Rust for Java Devs – Structs

Next up in Rust for Java Devs we have structs. They are used to hold data within a logical unit that can be passed to other functions or execute their own methods on the values that they store. Now this sounds very familiar… Java objects do the same thing. For example if you took a POJO (Plain Old Java Object) ...

Read More »

Rust for Java Devs – Creating functions

In this post of Rust for Java Devs we will look at creating functions in Rust. Functions in Rust do not differ that much from Java methods but there are a few little differences. There is also the topic of Rust’s lifetimes compared to Java’s garbage collection that one could argue separates the two from each other a bit more, ...

Read More »

Understanding Rust Loops

When you come from another language to learn Rust, some things may come across the same, but many things will be very different. Writing Rust loops can have the appearance of familiarity, but behind the scenes, Rust is translating those loops to its own syntax. If you learn that style for yourself, you will find Rust loops to be far ...

Read More »

Improving Performance by Writing a Custom Static Asset Server in Rust

The ability to serve static assets is critical for many SaaS products, including Shopblocks. Many of these products will store the files to be served in a segmented way, perhaps across multiple drives, and in multiple folders. At Shopblocks, our setup means that each customer has their assets stored on specific mounted drives, and in specific folders per customer. For ...

Read More »

Rust for Java Devs – Compiling code and using Cargo

After my last post seemed to be well received I am back with another Rust for Java Devs post. Today we will look at a compiling Rust code and have a brief look at using the basics of Cargo. For a developer there isn’t much difference between how to compile Rust code compared to Java, but where they vary are ...

Read More »

Rust Design Considerations with Borrowing

Rust has a fairly unique way of handling memory-freeing by implementing an ownership system. Each code item you create in Rust is assigned ownership/lifetime at the time of its creation. From that point on, you may choose to let the item be borrowed by things further on within the same scope or allow the ownership to be consumed (taken over) ...

Read More »

Rust for Java Devs – Creating Variables

I’m going to do something different today and write about Rust instead of Java. This is something that I want to give a try and if it all goes well I will continue writing some posts about Rust in the future. I will be writing about learning Rust from the perspective of a Java developer by making comparisons where appropriate ...

Read More »