Skip to content

Commit

Permalink
doc: nits and fixes part two
Browse files Browse the repository at this point in the history
  • Loading branch information
bluurryy committed Aug 22, 2024
1 parent 0e45e57 commit 02a7f01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/chunk_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<const UP: bool, A> RawChunk<UP, A> {

// The chunk size must always be a multiple of `CHUNK_ALIGN_MIN`.
// We use optimizations in `alloc` that require this.
// `ChunkSize::allocate` must have already trimmed the allocates size to a multiple of `CHUNK_ALIGN_MIN`
// `ChunkSize::allocate` must have already trimmed the allocation size to a multiple of `CHUNK_ALIGN_MIN`
debug_assert!(size % CHUNK_ALIGN_MIN == 0);

let header = unsafe {
Expand Down Expand Up @@ -154,8 +154,8 @@ impl<const UP: bool, A> RawChunk<UP, A> {
if IS_CONST_ALIGN && layout.align() <= MIN_ALIGN {
// alignment is already sufficient
} else {
// Aligning an address that is smaller or equal to `range.end` with an alignment
// that is smaller or equal to `CHUNK_ALIGN_MIN` can not exceed `range.end` and
// Aligning an address that is `<= range.end` with an alignment
// that is `<= CHUNK_ALIGN_MIN` can not exceed `range.end` and
// can not overflow as `range.end` is always aligned to `CHUNK_ALIGN_MIN`
start = up_align_usize_unchecked(start, layout.align());
}
Expand Down Expand Up @@ -401,8 +401,8 @@ impl<const UP: bool, A> RawChunk<UP, A> {

if IS_CONST_ALIGN && layout.align() <= CHUNK_ALIGN_MIN {
// SAFETY:
// Aligning an address that is smaller or equal to `range.end` with an alignment
// that is smaller or equal to `CHUNK_ALIGN_MIN` can not exceed `range.end` and
// Aligning an address that is `<= range.end` with an alignment
// that is `<= CHUNK_ALIGN_MIN` can not exceed `range.end` and
// can not overflow
start = unsafe { up_align_nonzero_unchecked(start, layout.align()) }
} else {
Expand Down Expand Up @@ -470,8 +470,8 @@ impl<const UP: bool, A> RawChunk<UP, A> {
let mut pos = nonnull::addr(self.pos()).get();

if UP {
// Aligning an address that is smaller or equal to `range.end` with an alignment
// that is smaller or equal to `CHUNK_ALIGN_MIN` can not exceed `range.end` and
// Aligning an address that is `<= range.end` with an alignment
// that is `<= CHUNK_ALIGN_MIN` can not exceed `range.end` and
// can not overflow as `range.end` is always aligned to `CHUNK_ALIGN_MIN`.
pos = up_align_usize_unchecked(pos, ALIGN);
} else {
Expand Down
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
//! * **`alloc`** — Adds `Global` as the default allocator, `BumpBox::into_box` and some interactions with `alloc` collections.
//! * **`serde`** — Adds `Serialize` implementations for `BumpBox`, strings and vectors, and `DeserializeSeed` for strings and vectors.
//! * **`zerocopy`** — Adds `alloc_zeroed(_slice)`, `init_zeroed`, `resize_zeroed` and `extend_zeroed`.
//!
//!
//! ### Nightly features
//! * **`nightly-allocator-api`** — Enables `allocator-api2`'s `nightly` feature which makes it reexport the nightly allocator api instead of its own implementation.
//! With this you can bump allocate collections from the standard library.
Expand Down Expand Up @@ -1507,9 +1507,9 @@ define_alloc_methods! {
/// assert_eq!(slice, [1, 2, 3]);
/// ```
impl
/// For better performance prefer [`alloc_iter_exact`](Bump::alloc_iter_exact) or <code>[alloc_iter_mut](Bump::alloc_iter_mut)([_rev](Bump::alloc_iter_mut_rev))</code>.
/// For better performance prefer [`alloc_iter_exact`](Bump::alloc_iter_exact) or <code>[alloc_iter_mut](Bump::alloc_iter_mut)</code>.
for pub fn alloc_iter
/// For better performance prefer [`try_alloc_iter_exact`](Bump::try_alloc_iter_exact) or <code>[try_alloc_iter_mut](Bump::try_alloc_iter_mut)([_rev](Bump::try_alloc_iter_mut_rev))</code>.
/// For better performance prefer [`try_alloc_iter_exact`](Bump::try_alloc_iter_exact) or <code>[try_alloc_iter_mut](Bump::try_alloc_iter_mut)</code>.
for pub fn try_alloc_iter
fn generic_alloc_iter<{T}>(&self, iter: impl IntoIterator<Item = T>) -> BumpBox<[T]> | BumpBox<'a, [T]> {
let iter = iter.into_iter();
Expand Down Expand Up @@ -1574,11 +1574,11 @@ define_alloc_methods! {
impl
/// Unlike [`alloc_iter`](Bump::alloc_iter), this function requires a mutable `Bump(Scope)`.
///
/// When bumping downwards, prefer [`alloc_iter_mut_rev`](Bump::alloc_iter_mut_rev) or [`alloc_iter_exact`](Bump::alloc_iter_exact) to avoid having to internally move the slice after creation.
/// When bumping downwards, prefer [`alloc_iter_mut_rev`](Bump::alloc_iter_mut_rev) or [`alloc_iter_exact`](Bump::alloc_iter_exact) to avoid a shift of the slice.
for pub fn alloc_iter_mut
/// Unlike [`try_alloc_iter`](Bump::try_alloc_iter), this function requires a mutable `Bump(Scope)`.
///
/// When bumping downwards, prefer [`try_alloc_iter_mut_rev`](Bump::try_alloc_iter_mut_rev) or [`try_alloc_iter_exact`](Bump::try_alloc_iter_exact) to avoid having to internally move the slice after creation.
/// When bumping downwards, prefer [`try_alloc_iter_mut_rev`](Bump::try_alloc_iter_mut_rev) or [`try_alloc_iter_exact`](Bump::try_alloc_iter_exact) to avoid a shift of the slice.
for pub fn try_alloc_iter_mut
fn generic_alloc_iter_mut<{T}>(&mut self, iter: impl IntoIterator<Item = T>) -> BumpBox<[T]> | BumpBox<'a, [T]> {
let iter = iter.into_iter();
Expand All @@ -1596,7 +1596,7 @@ define_alloc_methods! {
/// Allocate elements of an iterator into a slice in reverse order.
impl
///
/// When bumping upwards, prefer [`alloc_iter_mut`](Self::alloc_iter_mut) or [`alloc_iter_exact`](Self::alloc_iter_exact) tto avoid having to internally move the slice after creation.
/// When bumping upwards, prefer [`alloc_iter_mut`](Self::alloc_iter_mut) or [`alloc_iter_exact`](Self::alloc_iter_exact) to avoid a shift of the slice.
do examples
/// ```
/// # use bump_scope::Bump;
Expand All @@ -1607,7 +1607,7 @@ define_alloc_methods! {
/// ```
for pub fn alloc_iter_mut_rev
///
/// When bumping upwards, prefer [`try_alloc_iter_mut`](Self::try_alloc_iter_mut) or [`try_alloc_iter_exact`](Self::try_alloc_iter_exact) to avoid having to internally move the slice after creation.
/// When bumping upwards, prefer [`try_alloc_iter_mut`](Self::try_alloc_iter_mut) or [`try_alloc_iter_exact`](Self::try_alloc_iter_exact) to avoid a shift of the slice.
for pub fn try_alloc_iter_mut_rev
fn generic_alloc_iter_mut_rev<{T}>(&mut self, iter: impl IntoIterator<Item = T>) -> BumpBox<[T]> | BumpBox<'a, [T]> {
let iter = iter.into_iter();
Expand Down

0 comments on commit 02a7f01

Please sign in to comment.