[−][src]Function fungus::sys::readstring
pub fn readstring<T: AsRef<Path>>(path: T) -> Result<String>
Returns the contents of the path
as a String
.
Examples
use fungus::prelude::*; let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("file_doc_readstring"); assert!(sys::remove_all(&tmpdir).is_ok()); let tmpfile = tmpdir.mash("file1"); assert!(sys::mkdir(&tmpdir).is_ok()); assert!(sys::write(&tmpfile, "this is a test").is_ok()); assert_eq!(sys::readstring(&tmpfile).unwrap(), "this is a test"); assert!(sys::remove_all(&tmpdir).is_ok());