需要 Rust unzip() 类型注释

问题描述 投票:0回答:0

我正在尝试解压缩嵌套元组并使用组合器来执行此操作:

let create_task = |msg| {
    // We need to keep the message_id to report failures to SQS
    // and the receipt_handle to delete the processed messages from SQS.
    let SqsMessageObj {
        message_id,
        body,
        receipt_handle,
        ..
    } = msg;

    let span = tracing::span!(tracing::Level::INFO, "Handling SQS msg", message_id);
    let task = async {
        let item = serde_json::from_value(body)?;
        f(item, app_config).await
    };

    (
        (
            message_id.unwrap_or_default(),
            receipt_handle.unwrap_or_default(),
        ),
        task,
    )
};

print!("{:?}", event.payload);

let ((ids, receipts), tasks): ((_, _), _) = event
    .payload
    .records
    .into_iter()
    .map(create_task)
    .unzip::<(_, _), _, (_, _), _>();

编译器对此不满意。 unzip() 类型注释应该是什么?

rust iterator tuples unzip
© www.soinside.com 2019 - 2024. All rights reserved.