Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Substrate 已经将它自己的结果类型定义为Result<(), &'static str>并且不允许我使用泛型类型。如何使用 Rust 标准Result<T, E>类型?
Result<(), &'static str>
Result<T, E>
可以在模块的私有函数中使用 Rust 标准 Result 类型,但不能在可调度函数中使用。
您需要先导入它use rstd::result,然后使用它result::Result<your-value-type, your-error-type>。
use rstd::result
result::Result<your-value-type, your-error-type>