Programming · PRC-39

Rust Fundamentals with Generative AI

Rust Fundamentals with Generative AI is a hands-on course that takes developers from the Rust toolchain, ownership, borrowing and traits to async web APIs with Tokio and axum that call LLMs through the OpenAI Responses API and Ollama. It suits backend developers and teams adopting Rust, and you leave with an AI-powered service that runs in Docker.

Updated
From 10,350 THB / person 11,500 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration30 hours · 5 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

Many organisations are putting generative AI into real systems, from summarising documents and categorising requests to answering questions. These systems have to be fast, light on resources and stable under heavy use, which is why Rust is increasingly chosen for backends and services that need memory safety and high performance. For developers coming from other languages, though, ideas such as ownership, borrowing and lifetimes are often the first wall that slows learning down.

This course builds a solid Rust foundation step by step, from the toolchain to the core mechanics of the language, then moves on to asynchronous programming with Tokio, web APIs with axum and connecting to LLMs both in the cloud through the OpenAI Responses API and locally through Ollama. Every day extends one project, TicketPilot, until on the last day it is a service that uses generative AI to analyse sample tickets and runs in a Docker container. (5 days, 6 hours per day, 30 hours in total, Beginner to Intermediate level.)

What you’ll gain

  • Install and use the Rust toolchain (rustup, cargo, clippy, rustfmt) and structure projects correctly
  • Understand Rust syntax, data types, structs, enums and pattern matching
  • Understand and apply ownership, borrowing and lifetimes, and read borrow checker errors with reasoning
  • Design code with traits and generics and handle errors systematically with Result
  • Write asynchronous programs with Tokio and build web APIs with axum
  • Connect to LLMs through the OpenAI Responses API and Ollama from Rust code
  • Receive LLM results as structured output and convert them safely into Rust types with serde
  • Write unit tests and run the service in a Docker container

Who this course is for

  • Backend developers who want to add Rust for performance-critical work
  • Developers who want to build services or internal tools that connect to LLMs
  • Development teams considering Rust for their organisation's systems
  • Software engineers who want to understand memory management without a garbage collector
  • Learners who have finished Rust Programming and want to keep practising until they can build an AI-powered service

Prerequisites

  • Able to program in at least one language, such as Python, JavaScript/TypeScript, Java, C# or Go
  • Comfortable with basic concepts such as variables, functions, conditions, loops and data structures
  • Basic command line and Git skills, and a basic understanding of HTTP and JSON
  • No prior experience with Rust, C or C++ and no machine learning background is needed

Curriculum

Course Details

This course builds on Rust Programming (2 days), which covers the language basics, and spends 5 days making the core mechanics of Rust solid before using them to build an async web service that connects to generative AI both in the cloud and locally. It runs for 5 days, 6 hours per day (30 hours in total, 09:00-16:00), as lectures with labs and workshops on one project, TicketPilot, that grows every day. Beginner to Intermediate level. Learners use their own laptop

and their own or their organisation's OpenAI API key, which is billed by usage; anyone without a key can do the AI labs with Ollama on their own machine. As a fundamentals course it does not cover unsafe Rust, procedural macros, FFI, training or fine-tuning models, or running AI models directly in Rust, and tool calling is presented as a concept with a short example. Tool versions and model names change often, and the content follows the latest version on the training day.

Day 1 Rust Foundations and Toolchain

Section 1: Getting to Know Rust and Its Ecosystem

  • Why organisations choose Rust: memory safety, performance and safe concurrency
  • Where Rust fits and where it does not, compared with Go, Java, C# and Python
  • The six-week release cycle, the edition concept and what changed in Edition 2024
  • crates.io, docs.rs, The Rust Book and the community's main learning resources

Section 2: Lab: Installing and Using the Toolchain

  • Install rustup, choose the stable toolchain and keep it up to date
  • Core cargo commands: new, build, run, check, add, and the structure of Cargo.toml
  • Format code with rustfmt and check quality with clippy
  • Set up VS Code with rust-analyzer and learn to read compiler error messages
  • Lab: create a first project and fix clippy warnings

Section 3: Syntax and Basic Data Types

  • Variables, immutability by default, mut and shadowing
  • Scalar types, tuples, arrays and safe type conversion
  • Functions, expressions versus statements, and return values
  • Control flow: if, loop, while, for and ranges
  • Lab: exercises writing calculation functions and loops over data

Section 4: Structs, Enums and Pattern Matching

  • Define structs and methods with impl, including associated functions
  • Enums that carry data, and Option in place of null
  • match, if let and let else for exhaustive case handling
  • Lab: design the Ticket struct and enums for status and urgency

Section 5: Workshop: Modules and the TicketPilot CLI

  • mod, pub, use and splitting code into files by responsibility
  • Library crates versus binary crates, and project structure
  • Basic command line arguments with clap
  • Workshop: create the TicketPilot project and a CLI command that lists sample tickets
Day 2 Ownership, Borrowing and Collections

Section 6: Ownership and Memory Management

  • Stack versus heap, and why Rust does not need a garbage collector
  • Ownership rules, move semantics and freeing memory with Drop
  • Clone versus Copy, and the real cost of cloning
  • Lab: move values between variables and functions and read what the compiler says

Section 7: Borrowing and References

  • Immutable references (&T) and mutable references (&mut T)
  • The borrowing rules, and how to read borrow checker errors line by line
  • Common problems when starting with Rust and how to fix them by reasoning
  • Lab: fix code that does not compile without reaching for clone as a shortcut

Section 8: Lifetimes Basics

  • What a lifetime means and the lifetime elision rules
  • Annotating lifetimes in functions and in structs that hold references
  • Choosing between holding a reference and owning the data
  • Lab: write functions that return references the compiler accepts

Section 9: Strings, Slices and Collections

  • String versus &str, and working with UTF-8 text including Thai
  • Slices of arrays and vectors
  • Vec, HashMap and HashSet, and choosing the right one for the job
  • Iterating by borrowing (iter), mutating (iter_mut) and moving (into_iter)
  • The Entry API for counting and grouping data

Section 10: Workshop: Searching and Grouping Tickets

  • Write functions that search and filter tickets by status and urgency
  • Group tickets by category with HashMap and the Entry API
  • Design function signatures that take references instead of moving values
  • Workshop: review the code to remove unnecessary clones and compare before and after
Day 3 Traits, Generics, Error Handling and Testing

Section 11: Traits and Generics

  • Define and implement traits, with default methods
  • Generics with trait bounds, and impl Trait
  • Trait objects (dyn Trait) and choosing static or dynamic dispatch
  • Common standard traits: Debug, Display, From and Default
  • Lab: separate the ticket repository behind a trait

Section 12: Closures and Iterators

  • Closures and capturing variables from the surrounding scope
  • Iterator adapters: map, filter, fold and collect
  • Writing functional-style code that stays readable and avoids copying data
  • Lab: rewrite the Day 2 functions with iterators

Section 13: Systematic Error Handling

  • Result, the ? operator, and when panic! is the right choice
  • Create library error types with thiserror
  • Use anyhow at application level and add context to errors
  • Lab: create TicketPilot's error type and propagate errors correctly

Section 14: Serialisation with serde

  • Serialize and Deserialize with derive
  • Read and write JSON files with serde_json
  • Field renaming, default values and optional fields
  • Lab: load sample ticket data from a JSON file

Section 15: Workshop: Testing in Rust

  • Unit tests with #[test] and cargo test
  • Integration tests in the tests folder
  • Use traits to build a fake repository for testing
  • Workshop: a JSON file repository and an in-memory repository, with unit tests covering the main functions
Day 4 Async Rust, Web APIs and LLM Integration

Section 16: Async Rust with Tokio

  • async/await, futures and the role of the runtime
  • #[tokio::main], tokio::spawn and running work concurrently
  • Sharing state between tasks with Arc and Mutex or RwLock
  • Timeouts and cancellation
  • Lab: make several HTTP calls concurrently with reqwest

Section 17: Lab: Building a Web API with axum

  • Routers, handlers and extractors (Path, Query, Json, State)
  • Returning responses and errors as consistent JSON
  • Middleware with tower, such as logging and timeouts
  • Lab: endpoints to list tickets and fetch a single ticket

Section 18: LLM Basics for Developers

  • Tokens, context windows and the cost of each request
  • Designing instructions and input for summarising and categorising
  • Personal data under PDPA, and criteria for choosing a cloud or local model
  • Why LLM output must always be checked before it is used

Section 19: Connecting to the OpenAI Responses API and Ollama

  • Install async-openai with the responses feature and store the API key securely
  • Send requests, read results, and handle retries and rate limits
  • Install Ollama and a small model that runs on a laptop
  • Call Ollama over HTTP with reqwest and through its OpenAI-compatible endpoint
  • Lab: compare quality, speed and limits of cloud and local models

Section 20: Workshop: The TicketPilot API Calls an LLM

  • Design the POST /tickets/{id}/analyze endpoint
  • Send a ticket to the LLM to summarise and categorise it
  • Handle LLM errors and timeouts so the API still responds
  • Workshop: test the API with several types of sample ticket
Day 5 GenAI-Powered Rust Service (Master Workshop)

Section 21: Lab: Designing an LLM Provider with a Trait

  • Define an LlmProvider trait and implement it for OpenAI and Ollama
  • Choose the provider from configuration to meet the organisation's data requirements
  • Test with a fake provider without calling a real API
  • Lab: switch providers without changing the business logic

Section 22: Structured Output and Validating Results

  • Define a JSON schema for the analysis: category, urgency, summary and suggested reply
  • Convert results into structs with serde and handle output that does not match the schema
  • Bounded fallback and retry
  • Lab: ticket analysis the system can use straight away

Section 23: Streaming and Tool Calling Basics

  • Receive streamed output and pass it to the client with server-sent events in axum
  • The tool calling concept: letting the LLM call a Rust function to look up related tickets
  • Restrict permissions and validate arguments before running any function
  • Lab: a streaming endpoint for drafting replies

Section 24: Production Readiness and Docker

  • Structured logging with tracing
  • Managing configuration and secrets through environment variables
  • Graceful shutdown and a health check endpoint
  • Release builds, reducing binary size and a multi-stage Dockerfile
  • Lab: run the service alongside Ollama with Docker Compose

Section 25: Master Workshop: TicketPilot AI Service

  • Bring together the switchable provider, structured output and the streaming endpoint
  • Add logging, configuration and unit tests for the key parts
  • Build a Docker image and run it with Ollama
  • Present the result and summarise how to apply it to your organisation's systems

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

How does this course differ from Rust Programming?

Rust Programming is a 2-day course covering the basics of the language. This course runs for 5 days, drills ownership, borrowing, traits and error handling more thoroughly, then goes on to build an async web API with Tokio and axum that connects to LLMs through the OpenAI Responses API and Ollama, ending with a service that runs in Docker. Learners who have finished Rust Programming can continue here, and anyone new to Rust can start with this course directly.

Can I join if I have never written Rust, C or C++?

Yes. The course starts with installing the toolchain and basic syntax, then explains ownership and the borrow checker by comparing them with languages you already know. You should be able to program in at least one language and use the command line and Git at a basic level to keep pace with the workshops.

Do I need an OpenAI API key, and does the institute provide one?

The institute does not provide API keys. Learners use their own or their organisation's key, which is billed by actual usage; the labs use only a small amount. Anyone without a key, or who prefers not to send data off the machine, can do the AI labs with Ollama locally, because the course code is designed to switch providers.

What laptop specification do I need?

We recommend a Windows 10/11 or macOS laptop with at least 16 GB of RAM and 30 GB of free space for the toolchain and local LLM models, with permission to install software and VS Code, Git and Docker Desktop installed beforehand. Windows users should also install Visual Studio Build Tools and enable WSL2.

Does the course teach training models or running AI models directly in Rust?

No. The course focuses on connecting to LLMs through APIs, both cloud and local, and using the results safely in a system with structured output. Training or fine-tuning models, writing an inference engine in Rust, unsafe Rust and FFI are out of scope, so there is enough time to practise the core mechanics of the language.

Can I build on TicketPilot for real work, and can I use real data in class?

Yes. You take home the source code for every stage to adapt as a prototype service for your organisation. In class, only sample ticket data is used; do not bring real customer or personal data, and consider PDPA and your organisation's data policy before choosing a cloud or local LLM for real work.