Is it possible to match against a null pointer in rust? Calling is_null() does feel a bit odd.
fn do_stuff(ptr: *const i32) -> Option<i32> {
if ptr.is_null() {
None
} else {
Some(do_transform(*ptr, 42))
}
}
Is it possible to match against a null pointer in rust? Calling is_null() does feel a bit odd.
fn do_stuff(ptr: *const i32) -> Option<i32> {
if ptr.is_null() {
None
} else {
Some(do_transform(*ptr, 42))
}
}
برچسب:
نویسنده: استخدام کار