Updated import_input
signature, documentation
This commit is contained in:
parent
a7ef031090
commit
e9a161f526
16
src/lib.rs
16
src/lib.rs
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Result;
|
use std::io::Result;
|
||||||
use std::path::PathBuf;
|
use std::path::Path;
|
||||||
|
|
||||||
extern crate log;
|
extern crate log;
|
||||||
extern crate simplelog;
|
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
|
/// 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)
|
utils::read_file(&path)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user