Skip to content

Commit bfd0709

Browse files
authored
Add Virtaddr::is_null (#180)
1 parent 3ce339e commit bfd0709

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/addr.rs

+6
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ impl VirtAddr {
134134
self.as_ptr::<T>() as *mut T
135135
}
136136

137+
/// Convenience method for checking if a virtual address is null.
138+
#[inline]
139+
pub const fn is_null(self) -> bool {
140+
self.0 == 0
141+
}
142+
137143
/// Aligns the virtual address upwards to the given alignment.
138144
///
139145
/// See the `align_up` function for more information.

0 commit comments

Comments
 (0)