Skip to main content
Version: Pre-Alpha

Rust integration

Rust Examples

CodAPI

Welcome to our interactive Rust tutorial! This page demonstrates how to use Rust with live code examples.

Your First Rust Program

Let's start with a simple "Hello, World!" program:

    println!("Hello, World!");
main.rs

The program above demonstrates the basic structure of a Rust program. Let's break down what each part does:

  1. fn main() - This declares the main function, the entry point of our program
  2. println! - This is a macro that prints text to the console

Working with Variables

Here's an example showing how to work with variables in Rust:

main.rs

Functions in Rust

Let's explore how functions work in Rust:

main.rs

Error Handling Example

Here's how to handle potential errors in Rust:

main.rs

Generate Image

Image Generation Example

Here's an example of generating a gradient image using Rust:

main.rs

Each example above is interactive - you can modify the code and run it directly in your browser!