On this page
Function std::ptr::null
pub const fn null<T>() -> *const T
where
T: Thin + ?Sized,
Creates a null raw pointer.
This function is equivalent to zero-initializing the pointer: MaybeUninit::<*const T>::zeroed().assume_init()
. The resulting pointer has the address 0.
Examples
use std::ptr;
let p: *const i32 = ptr::null();
assert!(p.is_null());
assert_eq!(p as usize, 0); // this pointer has the address 0
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/ptr/fn.null.html