42xryy7ts 

   
   

Output:

{"session1": SystemTime { tv_sec: 1731289679, tv_nsec: 954506945 }}
by

Rust online compiler

Write, Run & Share Rust code online using OneCompiler’s Rust online compiler for free. It’s a fast, interactive, and powerful environment to learn and experiment with the Rust programming language. OneCompiler runs the latest stable version of Rust.

About Rust

Rust is a systems programming language developed by Mozilla that focuses on performance, memory safety, and concurrency. It guarantees memory safety without a garbage collector and is widely used for system-level programming, web assembly, and command-line tools. Rust's compiler enforces strict compile-time checks, making code safer and more predictable.

Sample Code

The following is a simple Rust program that prints a greeting:


Taking inputs (stdin)

OneCompiler’s Rust editor supports stdin. Here’s a sample program that reads a line of input and prints it:


Syntax Basics

Variables


Data Types

TypeDescription
i32, i64Signed integers
f32, f64Floating-point numbers
booltrue or false
charSingle character
StringGrowable string

Conditionals


Loops

For loop


While loop


Loop (infinite with break)


Functions



This guide provides a quick reference to Rust programming syntax and features. Start coding in Rust using OneCompiler’s Rust online compiler today!



© Copyright 2025 One Compiler Pvt. Ltd. | Privacy Policy | Terms & Conditions