shadow_shim_helper_rs/
notnull.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/// Panics if NULL (when debug asserts are enabled), and returns the pointer.
pub fn notnull_debug<T>(p: *const T) -> *const T {
    debug_assert!(!p.is_null());
    p
}

/// Panics if NULL (when debug asserts are enabled), and returns the pointer.
pub fn notnull_mut_debug<T>(p: *mut T) -> *mut T {
    debug_assert!(!p.is_null());
    p
}

/// Panics if NULL and returns the pointer.
pub fn notnull<T>(p: *const T) -> *const T {
    assert!(!p.is_null());
    p
}

/// Panics if NULL and returns the pointer.
pub fn notnull_mut<T>(p: *mut T) -> *mut T {
    assert!(!p.is_null());
    p
}