Myrddin Dundragon d395741822 Committing a set of basic rust examples.
This contains code and tests for several basic rust skills.
2025-06-27 15:55:37 -04:00
2025-06-27 08:48:57 -04:00
2025-06-27 08:48:57 -04:00
2025-06-27 08:48:57 -04:00

Example

A lightweight collection of examples demonstrating essential Rust features, without relying on external dependencies (except tokio).


Concepts Covered

  • Arrays and Iteration
  • Lifetimes and Borrowing
  • Error Handling with Result, ?, and custom messages
  • Async Programming using #[tokio::main]
  • File I/O with the standard library
  • Unit and async testing

Key Functions

Function Description
longest Returns the longest string in a slice without copying.
read_and_parse Reads a file and parses its content into an integer.
run_tasks Demonstrates spawning and awaiting async tasks.

Testing

Includes both synchronous and asynchronous unit tests under a #[cfg(test)] module.


Testing & Extending


Requirements

  • Rust 1.76+ (for full language support)
  • Tokio 1.37+ (for async runtime)

Project Structure

src/
├── info.rs       # Crate information from Cargo.
├── main.rs       # Foundational examples.

Copyright 2025 Jason Travis Smith

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this library except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS

Description
Just a small sample of Rust code.
Readme 56 KiB
Languages
Rust 100%