Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit c600195

Browse files
Max LarssonMax Larsson
Max Larsson
authored and
Max Larsson
committed
Added some documentation and added the README file to Cargo.toml
1 parent aba5220 commit c600195

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ authors = ["Max Larsson <[email protected]>"]
55
edition = "2018"
66
description = "A rust implementation of the python 'input' function."
77
repository = "https://github.com/maxslarsson/python-input"
8-
keywords = ["pytohn", "user", "input", "rust", "implementation"]
9-
license = "MIT"
8+
keywords = ["python", "user", "input", "rust", "implementation"]
9+
license = "MIT License"
10+
readme = "README.md"
1011

1112
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1213

src/lib.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
use std::io::{stdin, stdout, Write};
22

3-
pub fn input(input_string: &str) -> String {
4-
print!("{}", input_string);
3+
/// Returns a String with what the user typed in response to the prompt.
4+
///
5+
/// # Arguments
6+
///
7+
/// * `prompt` - A &str that is printed to the console as a prompt for the user.
8+
///
9+
/// # Remarks
10+
///
11+
/// This is a convenience function that just shortens the amount of code that is
12+
/// necessary to recieve user input in response to a prompt, such as a question.
13+
pub fn input(prompt: &str) -> String {
14+
print!("{}", prompt);
515
let mut input = String::new();
616

717
stdout().flush().expect("Failed to flush stdout!");

0 commit comments

Comments
 (0)