خرید بک لینک

Vote count: 0

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))
    }
}

asked 5 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 7 خرداد 1395 ساعت: 0:01

صفحه بندی