Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rust 结果是什么<;()>;你是说铁锈?_Rust_Rust Result - Fatal编程技术网

Rust 结果是什么<;()>;你是说铁锈?

Rust 结果是什么<;()>;你是说铁锈?,rust,rust-result,Rust,Rust Result,我正在查看函数文档,这引起了我的注意: std::io::Result 我的理解是,结果应该有T和E。如何用()替换它们?是特定于std::io模块的类型别名,定义为 type Result<T> = Result<T, ::std::io::Error>; 类型结果=结果; 本质上,它是一个std::result::result,错误类型前缀为std::io::error。您将注意到,使用此类型只需要一个类型参数,它对应于std::result::result中的

我正在查看函数文档,这引起了我的注意:

std::io::Result
我的理解是,结果应该有
T
E
。如何用
()
替换它们?

是特定于
std::io
模块的类型别名,定义为

type Result<T> = Result<T, ::std::io::Error>;
类型结果=结果;
本质上,它是一个
std::result::result
,错误类型前缀为
std::io::error
。您将注意到,使用此类型只需要一个类型参数,它对应于
std::result::result
中的“ok”类型(
T
),是特定于
std::io
模块的类型别名,定义为

type Result<T> = Result<T, ::std::io::Error>;
类型结果=结果;

本质上,它是一个
std::result::result
,错误类型前缀为
std::io::error
。您将注意到,使用此类型只需要一个类型参数,它对应于
std::result::result

中的“ok”类型(
T
),这是一个,而不是
std::result::result
。这是否回答了您的问题?谢谢@SCappella,你的链接和Brian的回答都很有帮助。这是一个,而不是一个
std::result::result
。这回答了你的问题吗?谢谢@SCappella,你的链接和Brian的答案都很有帮助。