我有一个像这样的 Rust 结构:
pub struct SomeMapping {
pub id: String,
pub other_id: Option<String>,
pub yet_another_id: Option<String>,
pub very_different_id: Option<String>
}
Run Code Online (Sandbox Code Playgroud)
检查所有可选 id 是否未设置的最简单方法是什么?我知道语法如下
if let Some(x) = option_value {...}
Run Code Online (Sandbox Code Playgroud)
从 中提取一个值Option,但我不知道如何以简洁的方式使用它来检查 的多个值None。
rust ×1