For even more Rust fun, join us at Workshop Day on Tuesday 26th March - the day before the main conference - for a full day of immersive training with leading industry trainers.
This year we are working with Ardan Labs, Mainmatter and Tim McNamara to bring you three full-day training options. Taking place on Tuesday 26th March 2024, the day before the Rust Nation UK conference, both course options run from 9am-4pm and include hands-on immersive training. Please bring your laptop and charging cable; power and WiFi will be available. Tickets include refreshments.
Our workshops will be held at etc.venues Monument. The address for this venue can be found here.
Unlock the power of Rust:
from concurrency to async and beyond
with Herbert WolversonIntermediate Level
PART 1: RUST'S SUPERPOWERS
Discover the unique strengths of Rust and the mechanisms that make them possible.
Fearless Concurrency & High-Performance Seatbelts
- Understanding Rust's concurrency promises
- The role and implications of the `unsafe` keyword.
- Mutexes in Rust: How they differ from other platforms.
- Real-world implications: Uber's data race challenges.
The Super-Power of Drop
- Introduction to the Drop trait and its significance.
- Practical demonstrations of Drop in action.
- Memory management in Rust: The magic behind it.
- The role of Rc and Arc in memory management.
- How libraries leverage Rust's memory management features.
- Dive into threading with a concise demo program.
PART 2: ASYNCHRONOUS PROGRAMMING
Demystifying async in Rust and harnessing its potential.
Understanding Async vs. Threads
- The evolution and current state of async in Rust.
- Key differences between async and threads.
- The benefits of lightweight, cooperatively scheduled async tasks.
- The ideal use cases for threads vs. async.
- Introduction to various async runtimes: Tokio, smol, glommer. Tokio:
The Heart of Rust's Async
- Building a REST server with Tokio, Serde, SQLX, and Axum.
- Introduction to Tower layer as a shared database resource.
- The power and efficiency of caching in Rust.
- Real-world performance metrics and implications.
- Efficiently handling thousands of requests with minimal resources.
- Construct a caching REST server and witness Rust's efficiency.
PART 3: THREADS AND ASYNC, HARMONIOUSLY COEXISTING
Explore the seamless integration of threaded and async worlds in Rust.
Threaded vs. Async: Myths Debunked
- Running multiple runtimes and their benefits.
- Communication between runtimes using MPSC channels.
- The role and function of `tokio::main`
- Customizing runtimes with Tokio's RuntimeBuilder and “block_on”.
- The benefits of controlling resource allocation across runtimes
Mixing Domains for Maximum Efficiency
- Practical demonstrations of combining threaded and async tasks.
- The power of Tokio's `spawn blocking`
- Communication between threaded and async domains.
- Building efficient systems with network services in Rust.
- The potential and benefits of read-write lock-protected storage.
- Build a multi-threaded system with network services, leveraging both threaded and async domains.
By the end of this workshop, you'll not only have a deep understanding of Rust's superpowers but also hands-on experience in harnessing them. Whether you're aiming to implement Rust in your workplace or just looking to expand your knowledge, this workshop is your ticket to the next level.Book your space
Succeeding with Rust in the enterprise
with Tim McNamara
Isolated - Rust-based microservices
We'll start by keeping Rust code at least a network call away from the rest of the stack. Participants will write a Rust-based microservice deployable as serverless, cloud native or bare metal environments.
Integrated - extension modules with Rust
Using Python as a case study, discover using Rust to build extension modules for other languages. Participants will be shown how to use Py03 to create a Python module written in Rust.
Hybrid - using Rust as a bridge
Discover the nuances of effectively combining Rust with other technologies and platforms. This part focuses on interoperability, covering methods to ensure Rust works harmoniously alongside existing enterprise technologies, thereby enhancing system robustness and efficiency.
The content is designed for software developers. It will also appeal to those who are making decisions on how to craft products for customers, such as enterprise architects and solutions architects.
Throughout the workshop, participants will engage in practical exercises, real-world case studies, and interactive discussions, gaining hands-on experience and deepening their understanding of Rust's role in modern enterprise solutions. Whether you're a seasoned Rustacean or newly embracing Rust in an enterprise setting, this workshop offers valuable insights and skills to enhance your organisation's technological prowess.Book your space
Testing for Rust projects:
going beyond the basics
with Luca PalmieriExpert Level
PART 1: Expanding your testing toolbox
No application is an island: you need to interact with third-party APIs, databases and who knows what else. Testing those interactions is tricky, to say the least! This workshop will focus on expanding your Rust testing toolkit, going beyond the basic techniques you’re already familiar with. At the end of the session, you’ll have a strategy to test most of the scenarios that are relevant for a complex Rust application.
The workshop is designed for software developers who have a good understanding of Rust’s basic concepts and want to move beyond the built-in testing toolkit.
The Rust standard library provides a few macros to perform assertions in your tests: assert!, assert_eq!, etc. They are good enough to get started, but the error messages they produce will often fail to keep up with the complexity of your assertions: we’ll explore different libraries to boost the clarify of your test failures.
Snapshot testing is a technique that allows us to capture the output of a system under test and compare it with a previously saved version. It is quite useful when working with complex data that might change frequently, such as HTML or error messages. We will explore how to use the insta crate to implement snapshot testing and manage the snapshots lifecycle.
PART 2: Isolating your tests
All tests in Rust share the same filesystem as the underlying host, a problematic situation when multiple tests want to interact with the “same” files or touch directories that could affect the behaviour of the system they are being executed from. We will explore various techniques to manage this scenario, including the tempfile crate.
The database is another shared resource that can cause problems when running tests in parallel. We will explore how to use Docker to run an isolated database instance for each test, and how to use the sqlx crate to manage the database lifecycle.
It is undesirable to have tests that hit real HTTP endpoints from third-party APIs, for a variety of reasons. We will explore how to use the wiremock crate to shield our tests from the outside world and make assertions on the HTTP requests that are being sent.
Mocks, stubs and fakes
In order to isolate the behaviour of a system under test, it is not unusual to replace some of its dependencies with “fake” implementations. We will explore the different types of fakes and how to use them in Rust. We will review, in particular, the mockall crate and the testing implications of using generics and dynamic dispatch for polymorphism.
Part 3: Custom test runners
What is a test?
We will take a look under the hood to understand how the Rust built-in testing framework works. Armed with this knowledge, we will explore the runtime implications of different approaches for test organisation. We will also cover alternative test runners, such as cargo-nextest.
Executing logic before and after a test run
It is often desirable to execute the same logic before and after each test in our suite. We will explore a variety of techniques to achieve this, from a bespoke #[test_case] procedural macro to a custom test harness (via libtest_mimic).
We will combine everything we have learned so far into an easy-to-use setup that allows you to run black-box tests against a real database and a real HTTP server, without having to orchestrate multiple commands—just cargo test and you are good to go!Book your space