Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

read file Rust

use std::fs;

fn main() {
  let content = match fs::read_to_string("Cargo.toml") {
    Result::Ok(value) => value,
    Result::Err(error) => panic!("{}", error) 
  };

  println!("{}", content)
}
Source by doc.rust-lang.org #
 
PREVIOUS NEXT
Tagged: #read #file #Rust
ADD COMMENT
Topic
Name
3+5 =