Updated `import_input` signature, documentation

This commit is contained in:
Lucien Cartier-Tilet 2020-03-28 21:58:27 +01:00
parent a7ef031090
commit e9a161f526
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
1 changed files with 14 additions and 2 deletions

View File

@ -14,7 +14,7 @@
use std::fs::File;
use std::io::Result;
use std::path::PathBuf;
use std::path::Path;
extern crate log;
extern crate simplelog;
@ -69,6 +69,18 @@ pub fn init() -> std::result::Result<(), log::SetLoggerError> {
}
/// Import user input from a text file and return them as a String
pub fn import_input(path: PathBuf) -> Result<String> {
///
/// # Arguments
///
/// * `path` - path to the file containing the user input
///
/// # Example
///
/// ```no_run
/// # use lang_evolve_core::import_input;
/// use std::path::Path;
/// let _input = import_input(Path::new("input.txt")).unwrap();
/// ```
pub fn import_input(path: &Path) -> Result<String> {
utils::read_file(&path)
}