Rename {NonZero,Shared,Unique}::new_checked to new
This commit is contained in:
@@ -75,7 +75,7 @@ impl<T: Zeroable> NonZero<T> {
|
|||||||
|
|
||||||
/// Creates an instance of NonZero with the provided value.
|
/// Creates an instance of NonZero with the provided value.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new_checked(inner: T) -> Option<Self> {
|
pub fn new(inner: T) -> Option<Self> {
|
||||||
if inner.is_zero() {
|
if inner.is_zero() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1115,8 +1115,8 @@ impl<T: ?Sized> Unique<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new `Unique` if `ptr` is non-null.
|
/// Creates a new `Unique` if `ptr` is non-null.
|
||||||
pub fn new_checked(ptr: *mut T) -> Option<Self> {
|
pub fn new(ptr: *mut T) -> Option<Self> {
|
||||||
NonZero::new_checked(ptr as *const T).map(|nz| Unique { pointer: nz, _marker: PhantomData })
|
NonZero::new(ptr as *const T).map(|nz| Unique { pointer: nz, _marker: PhantomData })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Acquires the underlying `*mut` pointer.
|
/// Acquires the underlying `*mut` pointer.
|
||||||
@@ -1234,8 +1234,8 @@ impl<T: ?Sized> Shared<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new `Shared` if `ptr` is non-null.
|
/// Creates a new `Shared` if `ptr` is non-null.
|
||||||
pub fn new_checked(ptr: *mut T) -> Option<Self> {
|
pub fn new(ptr: *mut T) -> Option<Self> {
|
||||||
NonZero::new_checked(ptr as *const T).map(|nz| Shared { pointer: nz, _marker: PhantomData })
|
NonZero::new(ptr as *const T).map(|nz| Shared { pointer: nz, _marker: PhantomData })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Acquires the underlying `*mut` pointer.
|
/// Acquires the underlying `*mut` pointer.
|
||||||
|
|||||||
Reference in New Issue
Block a user