An extension to Rust std for beginner exercises

Overview

note: this is for practicing rust only, do not use this in actual production programs!

really, don't.

[dependencies]
simple-std = "0.1.1"

simple-std is a little extension to the standard library, providing additional helpers for getting input or creating random numbers.

std is very useful, but it's lacking for little beginner exercises (for a good reason), so I made this library to help with that.

Every function from this library has a little section on why this function isn't in std, to help you understand the reasoning behind including something in std.

Examples

Greeting

use simple_std::input;

fn main() {
    println!("What is your name?");
    let name = input();
    println!("Hello {}!", name)
}

Guessing game

use std::cmp::Ordering;
use simple_std::{prompt, random_int_range}; 

fn main() {
    let number = random_int_range(0..100);
    loop {
        let input = prompt("Guess: ").parse::<i32>().expect("not a number");
        match input.cmp(&number) {
            Ordering::Less => println!("Too Small"),
            Ordering::Greater => println!("Too Big"),
            Ordering::Equal => {
                println!("You win!");
                break;
            }
        }
    }
}
You might also like...
Leetcode Solutions in Rust, Advent of Code Solutions in Rust and more

RUST GYM Rust Solutions Leetcode Solutions in Rust AdventOfCode Solutions in Rust This project demostrates how to create Data Structures and to implem

Simple autoclicker written in Rust, to learn the Rust language.

RClicker is an autoclicker written in Rust, written to learn more about the Rust programming language. RClicker was was written by me to learn more ab

Rust programs written entirely in Rust

mustang Programs written entirely in Rust Mustang is a system for building programs built entirely in Rust, meaning they do not depend on any part of

Rust 核心库和标准库的源码级中文翻译,可作为 IDE 工具的智能提示 (Rust core library and standard library translation. can be used as IntelliSense for IDE tools)

Rust 标准库中文版 这是翻译 Rust 库 的地方, 相关源代码来自于 https://github.com/rust-lang/rust。 如果您不会说英语,那么拥有使用中文的文档至关重要,即使您会说英语,使用母语也仍然能让您感到愉快。Rust 标准库是高质量的,不管是新手还是老手,都可以从中

A library for extracting #[no_mangle] pub extern "C" functions (https://docs.rust-embedded.org/book/interoperability/rust-with-c.html#no_mangle)

A library for extracting #[no_mangle] pub extern "C" functions In order to expose a function with C binary interface for interoperability with other p

clone of grep cli written in Rust. From Chapter 12 of the Rust Programming Language book

minigrep is a clone of the grep cli in rust Minigrep will find a query string in a file. To test it out, clone the project and run cargo run body poem

Rust-blog - Educational blog posts for Rust beginners

pretzelhammer's Rust blog 🦀 I write educational content for Rust beginners and Rust advanced beginners. My posts are listed below in reverse chronolo

The ray tracer challenge in rust - Repository to follow my development of
The ray tracer challenge in rust - Repository to follow my development of "The Raytracer Challenge" book by Jamis Buck in the language Rust

The Ray Tracer Challenge This repository contains all the code written, while step by implementing Ray Tracer, based on the book "The Ray Tracer Chall

Learn-rust-the-hard-way - "Learn C The Hard Way" by Zed Shaw Converted to Rust

Learn Rust The Hard Way This is an implementation of Zed Shaw's Learn X The Hard Way for the Rust Programming Language. Installing Rust TODO: Instruct

Releases(v0.1.1)
Owner
nils
hi, I'm nils
nils
A collection (eventually) of examples that use some non-beginner things.

nannou examples A collection (eventually) of examples that use some non-beginner things. Right now the only example combines nannou's standard draw AP

Alexis Andre 22 Oct 21, 2022
:crab: Small exercises to get you used to reading and writing Rust code!

rustlings ?? ❤️ Greetings and welcome to rustlings. This project contains small exercises to get you used to reading and writing Rust code. This inclu

The Rust Programming Language 33.1k Jan 2, 2023
This project contains small exercises to get you used to reading and writing Rust code

rustlings ?? ❤️ Greetings and welcome to rustlings. This project contains small exercises to get you used to reading and writing Rust code. This inclu

Cynthia Tran 1 May 24, 2022
A Rust no-std (de)compressor based on PAQ

MASHI まし A 100% no-std compatible Rust implementation of a PAQ style arithmetic coding, context mixing compressor. Its intended use case is compressin

null 7 Dec 14, 2022
Additional Rust collections not found in std::collections

More collections Rust crate with additional collections not found in std::collections. Multimaps Completion Name Behaves like ?? ?? ?? ⬜️ ⬜️ HashSetMu

Rinde van Lon 4 Dec 21, 2022
A tiny Rust std-lib for Linux x86_64 and aarch64

Tiny std Like a bad, probably buggy, tiny standard library for Linux. When it's appropriate If you are actually trying to do something solid, checkout

null 4 Dec 17, 2022
A no-std esp32 Wifi Lamp

Nostd-wifi-lamp A Wi-Fi controllable lamp written in Rust for the ESP32 using esp-hal. This was created for a blog post you can read here. Usage Sadly

null 9 Apr 30, 2023
Zero-copy, no-std proquint encoding and decoding

proqnt A pronounceable quintuplet, or proquint, is a pronounceable 5-letter string encoding a unique 16-bit integer. Proquints may be used to encode b

Jad Ghalayini 11 May 9, 2023
DWARF packaging utility, written in Rust, supporting GNU extension and DWARF 5 package formats.

thorin thorin is an DWARF packaging utility for creating DWARF packages (*.dwp files) out of input DWARF objects (*.dwo files; or *.o files with .dwo

The Rust Programming Language 19 Nov 16, 2022
HP++: A Hazard Pointers Extension for Better Applicability

HP++: A Hazard Pointers Extension for Better Applicability This is an implementation of HP++, a safe memory reclamation scheme proposed in Jaehwang Ju

KAIST Concurrency & Parallelism Laboratory 3 May 10, 2023