小编Nir*_*nde的帖子

特性 `std::convert::From<mongodb::error::Error>` 没有为 `std::io::Error` 实现

尝试使用 rust 中的 actix-web 和 mongodb 制作服务器。出现错误

该特征std::convert::From<mongodb::error::Error>未实现std::io::Error

这是我的代码

use actix_web::{web, App, HttpRequest, HttpServer, Responder};
use mongodb::{options::ClientOptions, Client};

async fn greet(req: HttpRequest) -> impl Responder {
    let name = req.match_info().get("name").unwrap_or("World");
    format!("Hello {}!", &name)
}

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
    // Parse a connection string into an options struct.
    let mut client_options = ClientOptions::parse("mongodb://localhost:27017")?;

    // Manually set an option.
    client_options.app_name = Some("My App".to_string());

    // Get a handle to the deployment.
    let client = Client::with_options(client_options)?;

    // List …
Run Code Online (Sandbox Code Playgroud)

mongodb rust rust-crates actix-web

4
推荐指数
1
解决办法
5085
查看次数

从 Svelte Store 获取/读取值

我想在任何给定时间读取精简的存储价值。我了解更新值时会调用 subscribe 方法。即使商店没有更新,我也想阅读商店。

svelte svelte-store svelte-3

3
推荐指数
1
解决办法
2522
查看次数

标签 统计

actix-web ×1

mongodb ×1

rust ×1

rust-crates ×1

svelte ×1

svelte-3 ×1

svelte-store ×1