mop-common 0.5.0

Common definitions for MOP crates.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#[cfg(feature = "std")]
use std::{
  fs::File,
  io::{self, prelude::*, BufReader},
  path::Path,
};

#[cfg(feature = "std")]
pub fn file_get_contents<P: AsRef<Path>>(filename: P) -> io::Result<String> {
  let file = File::open(filename)?;
  let mut buf_reader = BufReader::new(file);
  let mut contents = String::new();
  buf_reader.read_to_string(&mut contents)?;
  Ok(contents)
}