Macro assert_some
Source macro_rules! assert_some {
($opt:expr) => { ... };
($opt:expr, $msg:expr) => { ... };
}
Expand description
断言 Option 为 Some,返回值
ⓘlet value: Option<String> = Some("test".to_string());
let inner = assert_some!(value, "test_some");
assert_eq!(inner, "test");