Rust Bytes: Build Blazing-Fast Static Sites with Zola (written in Rust)
Hello Rustacean! Welcome to another edition of the Rust Bytes newsletter. In this issue, we'll shine a spotlight on an amazing Rust project, present our spot-the-bug challenge, and share some incredible links of the week.
Welcome to Issue 15!
The Main Thing
Rust Nation UK 2024 Kicks Off This Week
Key Dates: March 26th, 27th, and 28th, 2024
Location: The Brewery, London
Theme: Join hundreds of Rust developers for three exciting days of Rust talks, training, and workshops.
Speakers:
Leading speakers from around the world will be presenting on a variety of topics related to Rust development.
Confirmed speakers include Hannah Aubry, Nicholas Matsakis, Lars Bergstrom, and Alice Ryhl.
Talks:
A wide range of talks will be offered, covering topics such as:
Rust infrastructure and development
Safe coding practices
WebAssembly with Rust
Building applications with Rust
Integrating Rust with other languages
Open source Rust projects
Workshops:
Interactive workshops will provide attendees with hands-on experience with Rust development.
Topics include:
Functional safety systems with Rust
Creating microservice apps with Rust
Building a profiler for WebAssembly
Testing Rust applications
Keynotes:
The conference will feature keynote addresses by:
Hannah Aubry: The future of the internet depends on trust
Lars Bergstrom: How Rust fuels team productivity
Nicholas Matsakis: Rust 2024 and beyond
Alice Ryhl: What it takes to keep Tokio running
Other Highlights:
Networking opportunities with other Rust developers
Refreshment breaks and meals
Social events on both evenings
Rust Pun
Why did the Rust programmer go broke? Because he kept trying to borrow everything and never returned it!
Spot the Bug
Iterator Sum Mystery.
Identify why the code fails to compile and suggest a way to fix it
Share your solution in the comments below for a chance to be featured in our next newsletter!
Project Spotlight
Zola
Zola (pronounced "Zoh-la") is a powerful static site generator designed to be fast, user-friendly, and feature-rich. Here's a breakdown of what Zola offers:
Key Features:
Single Binary: Zola comes as a single executable, eliminating the need to manage complex dependencies.
Blazing Fast: Zola generates static sites exceptionally quickly, even with features like Sass compilation and syntax highlighting.
Scalable: Static sites are inherently scalable, meaning Zola-generated sites can handle high traffic without needing a server or database.
Easy to Use: Zola boasts an intuitive command-line interface (CLI) and template engine, making it accessible for users of all experience levels.
Flexible: Zola prioritizes your content, allowing you to create blogs, knowledge bases, landing pages, or any combination with ease.
Feature Packed:
Syntax highlighting for code snippets.
Sass compilation for stylish CSS.
Built-in image processing.
Theme support for customization.
Shortcodes for adding reusable content elements.
Automatic table of contents generation.
Automatic header anchors for easy navigation.
Multilingual site support (basic currently).
Internal link checking for broken links.
Pagination for managing large amounts of content.
Custom taxonomies for organizing content.
Built-in search functionality, eliminating the need for external servers.
Live reload for a seamless development experience.
Easy deployment to popular platforms like Netlify, Vercel, and Cloudflare.
Augmented Markdown: Zola extends Markdown with features like shortcodes and internal links, making content creation more streamlined.
Why Zola?
The creator of Zola specifically designed it out of frustration with the complexity of other static site generators. Zola aims to provide a user-friendly and feature-rich alternative for building static websites.
Getting Started
Zola is open-source on GitHub.
Awesome links of the week
Last week marked the 35th anniversary of the web. However, Sir Tim Berners-Lee, aka"Father of the web”, cautions against its current trajectory, highlighting a skew towards corporate interests prioritizing profit over people. He advocates for a future that is user-centric, emphasizing control over data and fostering collaboration.
Rust v 1.77.0 release is here, bringing stability to exciting API’s, changes to cargo, rustc, and rustdoc. I am particularly excited about the stabilization of the File::create_new, and array::each_mut APIs.
Driven by the desire to emulate Rust's error handling, Ethan Evans explores C23 macros as a potential solution to create a similar functionality in C. Read his article here to see how he tackles this challenge!
Sudo-rs offers a memory-safe alternative to traditional sudo and su utilities. Read about how they reduced the number of external dependencies in their codebase from 145 to just 3!
Phil Eaton wrote an article on "Zig, Rust, and other languages" that dives into the pros and cons of different choices made by programming languages like Zig, Rust, and Go. The focus is on three areas: memory management, standard libraries, and explicit allocation.
Compilation times are a common gripe in Rust, but the culprit can be a moving target. Our friend Kobzol dives deep with a new tool that breaks down where time is spent during compilation. Check out the full guide here.
Oleksandr Kaleniuk wrote a thought-provoking article titled "The Real C++ Killers (Not You, Rust)" where he discusses the challenges and limitations of C++, suggesting a move towards more modern languages and technologies.
Ben Wishovich wrote a guide on “Compiling Rust to WASI” where he demonstrates how to bring Rust code to the web. The focus is on WebAssembly System Interface (WASI), a system interface that makes it easier for Rust to work with WebAssembly (WASM).
Learn why Vortexa, Shuttle_dev, and ArwenAi chose Rust and how they use it in production in this panel discussion featuring Edward Wright (Lead GIS Engineer at Vortexa), Nodar Daneliya (Founder and CEO of Shuttle), Luca Palmieri (Principal Engineering Consultant), and James Cole (Arwen.ai).
Adrian wrote a guide on smart pointers in Rust. He explains what smart pointers are and why they're essential for memory management in Rust, along with code examples to illustrate their use.
Spot The Bug: Solution
Explanation:
The Bug: type annotations needed.
The compiler encounters a situation where it can't infer the type of the variable `sum`. This often happens when using methods like `sum()` on iterators. In this case, the `sum()` method requires the type to implement the `Sum` trait, but the compiler isn't sure which specific type `sum` should be.
Solution:
Explicitly specify the type:
```
fn main() {
let v = vec![1, 2, 3];
let sum = v.iter().map(|x| x * 2).sum::<i32>();
println!("Sum: {}", sum);
}
```
Before You Go
To support the newsletter:
❤️ Recommend the newsletter to your friends: it really helps!
💸 Sponsor the newsletter
🤳 Check us out on our socials: X, Rustaceans Publication.
📨 Contact us through rustaceanseditors@gmail.com feedback is welcome
That's all for now, Rustaceans! Until next week, have a productive week ahead.