Rust 如何使用state和factory构建actixweb测试服务器?

Rust 如何使用state和factory构建actixweb测试服务器?,rust,rust-actix,Rust,Rust Actix,在中,有两个示例介绍如何使用工厂函数构建: 使用actix_web:{http,test,App,HttpRequest,HttpResponse}; // ... fn main(){ 让mut srv=test::TestServer::with_factory(创建_应用程序); // ... } 或使用应用程序状态: fn测试(){ 让srv=TestServer::使用_状态(||)构建_{ // ... }); //运行测试 } 我想使用工厂函数构建一个状态为和的TestServ

在中,有两个示例介绍如何使用工厂函数构建:

使用actix_web:{http,test,App,HttpRequest,HttpResponse};
// ...
fn main(){
让mut srv=test::TestServer::with_factory(创建_应用程序);
// ...
}
或使用应用程序状态

fn测试(){
让srv=TestServer::使用_状态(||)构建_{
// ...
});
//运行测试
}
我想使用工厂函数构建一个状态为
TestServer
,但到目前为止还没有成功

如何做到这一点