Feature gate: #![feature(pointer_is_aligned)]
Feature gate: #![feature(pointer_is_aligned_to)]
This is a tracking issue for ptr.is_aligned() and ptr.is_aligned_to(alignment).
Public API
impl *const T {
// feature gate `pointer_is_aligned` was stabilized
// pub fn is_aligned(self) -> bool where T: Sized;
// feature gate `pointer_is_aligned_to`
pub fn is_aligned_to(self, align: usize) -> bool;
}
// ... and the same for` *mut T`
impl <T: ?Sized> NonNull<T> {
pub const fn is_aligned_to(self, align: usize) -> bool;
}
Steps / History
pointer_is_aligned:
pointer_is_aligned_to:
Unresolved Questions
- Should is_aligned_to require a power of two or should it be more flexible? (currently panics)
Feature gate:#![feature(pointer_is_aligned)]Feature gate:
#![feature(pointer_is_aligned_to)]This is a tracking issue for
ptr.is_aligned()andptr.is_aligned_to(alignment).Public API
Steps / History
pointer_is_aligned:pointer_is_aligned_to:NonNullmethod to this gate Stabilizenon_null_convenience#124498Unresolved Questions