Crates.io | reader |
lib.rs | reader |
version | 0.1.4 |
source | src |
created_at | 2020-12-01 03:00:42.901028 |
updated_at | 2020-12-22 21:16:03.13029 |
description | A simple python-inspired terminal data reader |
homepage | |
repository | https://github.com/hermanodecastro/reader |
max_upload_size | |
id | 318453 |
size | 6,222 |
A simple python-inspired terminal data reader.
extern crate reader;
use reader::input;
let name = input("Enter your name: ");
println!("Your name is: {}", name);
extern crate reader;
use reader::{input, int};
// Reading a integer (i64)
let age = int(input("Enter your age: ")).unwrap();
println!("Your age is: {}", age);
// Reading a integer (i32)
let age = int(input("Enter your age: ")).unwrap() as i32;
println!("Your age is: {}", age);
// Reading a integer (i16)
let age = int(input("Enter your age: ")).unwrap() as i16;
println!("Your age is: {}", age);
// Reading a integer (i8)
let age = int(input("Enter your age: ")).unwrap() as i8;
println!("Your age is: {}", age);
extern crate reader;
use reader::{input, float};
// Reading a float (f64)
let salary = float(input("Enter your salary: ")).unwrap();
println!("Your salary is: {}", salary);
// Reading a float (f32)
let salary = float(input("Enter your salary: ")).unwrap() as f32;
println!("Your salary is: {}", salary);