在Rust中,这是不可能的,因为类型错误expected closure, found a different closure。编译器将HashMap中的类型推断为<String, WhateverTypeTheFirstClosureIs>。第二个闭包没有相同的时间,因为编译器错误接着说,no two closures, even if identical, have the same type
作为一个学习生锈的项目,我正在编写一个程序,它可以解析sgf文件(一种存储go游戏的格式,技术上也包括其他游戏)。目前,程序应该将类型的字符串(这只是一个示例)解析为";B[ab]B[cd]W[ef]B[gh]"到[Black((0,1)),Black((2,3,)),White((4,5)),Black((6,7我遇到了以下错误:
main.rs:44:15: 44:39 error: can't infer the "kind" of the clos