Loading

Paste #p4n4cpvqb

  1. #[derive(Debug)]
  2. struct File {
  3.   name: String,
  4.   data: Vec<u8>,
  5. }
  6.  
  7. fn main() {
  8.   let f1 = File {
  9.     name: String::from("f1.txt"),
  10.     data: Vec::new(),
  11.   };
  12.  
  13.   let f1_name = &f1.name;
  14.   let f1_length = &f1.data.len();
  15.  
  16.   println!("{:?}", f1);
  17.   println!("{} is {} bytes long", f1_name, f1_length);
  18. }