我试图从文件中读取值以创建一个结构体,但我遇到了一对奇怪的错误。我的代码的超级基本实现:
extern crate itertools;
use itertools::Itertools;
use std::io::{self, prelude::*, BufReader};
use std::fs::{self, File};
// The struct I will unpack into
struct BasicExample {
a: String,
b: String,
c: String,
d: String,
}
impl BasicExample {
pub fn new(a: String, b: String, c: String, d: String} -> Self {
BasicExample {
a, b, c, d
}
}
// I'm expecting that reading from the config file might fail, so
// I want to return a Result that can be unwrapped. Otherwise …Run Code Online (Sandbox Code Playgroud) rust ×1