相关疑难解决方法(0)

结果得到意外的类型参数

我试图从文件中读取值以创建一个结构体,但我遇到了一对奇怪的错误。我的代码的超级基本实现:

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

6
推荐指数
2
解决办法
2433
查看次数

标签 统计

rust ×1