HackerTrans
TopNewTrendsCommentsPastAskShowJobs

baysmith

no profile record

comments

baysmith
·3 tahun yang lalu·discuss
I think using . for both field/method access and name pathing would hurt readability and make name lookup more difficult. Perhaps replace :: with a backtick instead?

  use std;
  use std`fs`File;
  pub fn read<P: AsRef<Path>>(path: P) -> io`Result<Vec<u8>> {
    fn inner(path: &Path) -> io`Result<Vec<u8>> {
      let mut file = File`open(path)?;
      let mut bytes = Vec`new();
      file.read_to_end(&mut bytes)?;
      Ok(bytes)
    }
    inner(path.as_ref())
  }