Skip to content

Commit

Permalink
doc: fix links, replace concrete types with Self
Browse files Browse the repository at this point in the history
  • Loading branch information
bluurryy committed Oct 24, 2024
1 parent e53755b commit afe1e2c
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 77 deletions.
6 changes: 3 additions & 3 deletions src/bump_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub(crate) use slice_initializer::BumpBoxSliceInitializer;
/// ```
/// </details>
///
/// [`into_ref`]: BumpBox::into_ref
/// [`into_ref`]: Self::into_ref
/// [`into_mut`]: BumpBox::into_mut
/// [`into_box`]: BumpBox::into_box
/// [`leak`]: BumpBox::leak
Expand Down Expand Up @@ -1140,8 +1140,8 @@ impl<'a, T> BumpBox<'a, [T]> {
/// assert_eq!(slice, []);
/// ```
///
/// [`clear`]: BumpBox::clear
/// [`drain`]: BumpBox::drain
/// [`clear`]: Self::clear
/// [`drain`]: Self::drain
pub fn truncate(&mut self, len: usize) {
unsafe { nonnull::truncate(&mut self.ptr, len) }
}
Expand Down
38 changes: 19 additions & 19 deletions src/bump_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ where
/// assert_eq!(vec, []);
/// ```
///
/// [`clear`]: BumpVec::clear
/// [`drain`]: BumpVec::drain
/// [`clear`]: Self::clear
/// [`drain`]: Self::drain
pub fn truncate(&mut self, len: usize) {
self.fixed.truncate(len);
}
Expand Down Expand Up @@ -774,11 +774,11 @@ where
/// - `new_len` must be less than or equal to the [`capacity`].
/// - The elements at `old_len..new_len` must be initialized.
///
/// [`resize`]: BumpVec::resize
/// [`truncate`]: BumpVec::truncate
/// [`extend`]: BumpVec::extend
/// [`clear`]: BumpVec::clear
/// [`capacity`]: BumpVec::capacity
/// [`resize`]: Self::resize
/// [`truncate`]: Self::truncate
/// [`extend`]: Self::extend
/// [`clear`]: Self::clear
/// [`capacity`]: Self::capacity
#[inline]
pub unsafe fn set_len(&mut self, new_len: usize) {
self.fixed.set_len(new_len);
Expand Down Expand Up @@ -899,7 +899,7 @@ where
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with copyable slices instead.
///
/// [`extend`]: BumpVec::extend
/// [`extend`]: Self::extend
impl
for fn extend_from_slice_copy
for fn try_extend_from_slice_copy
Expand All @@ -918,7 +918,7 @@ where
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with slices instead.
///
/// [`extend`]: BumpVec::extend
/// [`extend`]: Self::extend
impl
for fn extend_from_slice_clone
for fn try_extend_from_slice_clone
Expand Down Expand Up @@ -949,7 +949,7 @@ where
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with arrays instead.
///
/// [`extend`]: BumpVec::extend
/// [`extend`]: Self::extend
#[allow(clippy::needless_pass_by_value)]
impl
for fn extend_from_array
Expand Down Expand Up @@ -1239,8 +1239,8 @@ where
/// [`Clone`]), use [`resize_with`].
/// If you only need to resize to a smaller size, use [`truncate`].
///
/// [`resize_with`]: BumpVec::resize_with
/// [`truncate`]: BumpBox::truncate
/// [`resize_with`]: Self::resize_with
/// [`truncate`]: Self::truncate
impl
do examples
/// ```
Expand Down Expand Up @@ -2127,20 +2127,20 @@ where
/// (e.g. by reading from a file) before marking the data as initialized using
/// the [`set_len`] method.
///
/// [`set_len`]: BumpBox::set_len
/// [`set_len`]: Self::set_len
///
/// Note that this is a low-level API, which should be used with care for
/// optimization purposes. If you need to append data to a `BumpVec`
/// you can use [`push`], [`extend`], `extend_from_slice`[`_copy`](BumpVec::extend_from_slice_copy)`/`[`_clone`](BumpVec::extend_from_within_clone),
/// `extend_from_within`[`_copy`](BumpVec::extend_from_within_copy)`/`[`_clone`](BumpVec::extend_from_within_clone), [`insert`], [`resize`] or
/// [`resize_with`], depending on your exact needs.
///
/// [`push`]: BumpVec::push
/// [`extend`]: BumpVec::extend
/// [`insert`]: BumpVec::insert
/// [`append`]: BumpVec::append
/// [`resize`]: BumpVec::resize
/// [`resize_with`]: BumpVec::resize_with
/// [`push`]: Self::push
/// [`extend`]: Self::extend
/// [`insert`]: Self::insert
/// [`append`]: Self::append
/// [`resize`]: Self::resize
/// [`resize_with`]: Self::resize_with
#[inline]
pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit<T>]) {
let ptr = self.as_mut_ptr();
Expand Down
2 changes: 2 additions & 0 deletions src/bump_vec/splice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ macro_rules! splice_declaration {
/// assert_eq!(old, [1, 2]);
/// assert_eq!(v, [0, 7, 8]);
/// ```
///
/// [`BumpVec::splice()`]: crate::BumpVec::splice
#[derive(Debug)]
pub struct Splice<
'a,
Expand Down
4 changes: 2 additions & 2 deletions src/fixed_bump_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ use core::{
/// ```
///
/// [`alloc_fixed_string`]: crate::Bump::alloc_fixed_string
/// [`from_uninit`]: FixedBumpString::from_uninit
/// [`from_init`]: FixedBumpString::from_init
/// [`from_uninit`]: Self::from_uninit
/// [`from_init`]: Self::from_init
// `FixedBumpString` and `FixedBumpVec<u8>` have the same repr.
#[repr(C)]
pub struct FixedBumpString<'a> {
Expand Down
24 changes: 12 additions & 12 deletions src/fixed_bump_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ use core::{
/// ```
///
/// [`alloc_fixed_vec`]: crate::Bump::alloc_fixed_vec
/// [`from_uninit`]: FixedBumpVec::from_uninit
/// [`from_init`]: FixedBumpVec::from_init
/// [`from_uninit`]: Self::from_uninit
/// [`from_init`]: Self::from_init
// `FixedBumpString` and `FixedBumpVec<u8>` have the same repr.
#[repr(C)]
pub struct FixedBumpVec<'a, T> {
Expand Down Expand Up @@ -309,8 +309,8 @@ impl<'a, T> FixedBumpVec<'a, T> {
/// assert_eq!(vec, []);
/// ```
///
/// [`clear`]: FixedBumpVec::clear
/// [`drain`]: FixedBumpVec::drain
/// [`clear`]: Self::clear
/// [`drain`]: Self::drain
pub fn truncate(&mut self, len: usize) {
self.initialized.truncate(len);
}
Expand Down Expand Up @@ -427,9 +427,9 @@ impl<'a, T> FixedBumpVec<'a, T> {
/// - `new_len` must be less than or equal to the [`capacity`].
/// - The elements at `old_len..new_len` must be initialized.
///
/// [`truncate`]: FixedBumpVec::truncate
/// [`clear`]: FixedBumpVec::clear
/// [`capacity`]: FixedBumpVec::capacity
/// [`truncate`]: Self::truncate
/// [`clear`]: Self::clear
/// [`capacity`]: Self::capacity
#[inline]
pub unsafe fn set_len(&mut self, new_len: usize) {
self.initialized.set_len(new_len);
Expand Down Expand Up @@ -607,7 +607,7 @@ impl<'a, T> FixedBumpVec<'a, T> {
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with copyable slices instead.
///
/// [`extend`]: FixedBumpVec::extend
/// [`extend`]: Self::extend
impl
for fn extend_from_slice_copy
for fn try_extend_from_slice_copy
Expand All @@ -626,7 +626,7 @@ impl<'a, T> FixedBumpVec<'a, T> {
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with slices instead.
///
/// [`extend`]: FixedBumpVec::extend
/// [`extend`]: Self::extend
impl
for fn extend_from_slice_clone
for fn try_extend_from_slice_clone
Expand Down Expand Up @@ -657,7 +657,7 @@ impl<'a, T> FixedBumpVec<'a, T> {
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with arrays instead.
///
/// [`extend`]: FixedBumpVec::extend
/// [`extend`]: Self::extend
#[allow(clippy::needless_pass_by_value)]
impl
for fn extend_from_array
Expand Down Expand Up @@ -888,8 +888,8 @@ impl<'a, T> FixedBumpVec<'a, T> {
/// [`Clone`]), use [`resize_with`].
/// If you only need to resize to a smaller size, use [`truncate`].
///
/// [`resize_with`]: FixedBumpVec::resize_with
/// [`truncate`]: BumpBox::truncate
/// [`resize_with`]: Self::resize_with
/// [`truncate`]: Self::truncate
impl
do examples
/// ```
Expand Down
8 changes: 4 additions & 4 deletions src/mut_bump_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ macro_rules! mut_bump_string_declaration {
///
/// You can create a `MutBumpString` from [a literal string][`&str`] with [`MutBumpString::from_str_in`]:
///
/// [`into_str`]: MutBumpString::into_str
/// [`into_str`]: Self::into_str
///
/// ```
/// # use bump_scope::{ Bump, MutBumpString };
Expand All @@ -99,8 +99,8 @@ macro_rules! mut_bump_string_declaration {
/// assert_eq!(hello.as_str(), "Hello, world!");
/// ```
///
/// [`push`]: MutBumpString::push
/// [`push_str`]: MutBumpString::push_str
/// [`push`]: Self::push
/// [`push_str`]: Self::push_str
///
/// If you have a vector of UTF-8 bytes, you can create a `MutBumpString` from it with
/// the [`from_utf8`] method:
Expand All @@ -118,7 +118,7 @@ macro_rules! mut_bump_string_declaration {
/// ```
///
/// [`&str`]: prim@str "&str"
/// [`from_utf8`]: MutBumpString::from_utf8
/// [`from_utf8`]: Self::from_utf8
#[repr(C)]
pub struct MutBumpString<
'b,
Expand Down
44 changes: 22 additions & 22 deletions src/mut_bump_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ impl<'b, 'a: 'b, T, A, const MIN_ALIGN: usize, const UP: bool, const GUARANTEED_
/// assert_eq!(vec, []);
/// ```
///
/// [`clear`]: MutBumpVec::clear
/// [`drain`]: MutBumpVec::drain
/// [`clear`]: Self::clear
/// [`drain`]: Self::drain
pub fn truncate(&mut self, len: usize) {
self.fixed.truncate(len);
}
Expand Down Expand Up @@ -512,7 +512,7 @@ impl<'b, 'a: 'b, T, A, const MIN_ALIGN: usize, const UP: bool, const GUARANTEED_
/// assert_eq!(v, ["baz", "qux"]);
/// ```
///
/// [`remove`]: MutBumpVec::remove
/// [`remove`]: Self::remove
#[inline]
pub fn swap_remove(&mut self, index: usize) -> T {
self.fixed.swap_remove(index)
Expand Down Expand Up @@ -596,11 +596,11 @@ impl<'b, 'a: 'b, T, A, const MIN_ALIGN: usize, const UP: bool, const GUARANTEED_
/// - `new_len` must be less than or equal to the [`capacity`].
/// - The elements at `old_len..new_len` must be initialized.
///
/// [`resize`]: MutBumpVec::resize
/// [`truncate`]: MutBumpVec::truncate
/// [`extend`]: MutBumpVec::extend
/// [`clear`]: MutBumpVec::clear
/// [`capacity`]: MutBumpVec::capacity
/// [`resize`]: Self::resize
/// [`truncate`]: Self::truncate
/// [`extend`]: Self::extend
/// [`clear`]: Self::clear
/// [`capacity`]: Self::capacity
#[inline]
pub unsafe fn set_len(&mut self, new_len: usize) {
self.fixed.set_len(new_len);
Expand Down Expand Up @@ -721,7 +721,7 @@ where
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with copyable slices instead.
///
/// [`extend`]: MutBumpVec::extend
/// [`extend`]: Self::extend
impl
for fn extend_from_slice_copy
for fn try_extend_from_slice_copy
Expand All @@ -740,7 +740,7 @@ where
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with slices instead.
///
/// [`extend`]: MutBumpVec::extend
/// [`extend`]: Self::extend
impl
for fn extend_from_slice_clone
for fn try_extend_from_slice_clone
Expand Down Expand Up @@ -771,7 +771,7 @@ where
/// Note that this function is same as [`extend`] except that it is
/// specialized to work with arrays instead.
///
/// [`extend`]: MutBumpVec::extend
/// [`extend`]: Self::extend
#[allow(clippy::needless_pass_by_value)]
impl
for fn extend_from_array
Expand Down Expand Up @@ -1062,8 +1062,8 @@ where
/// [`Clone`]), use [`resize_with`].
/// If you only need to resize to a smaller size, use [`truncate`].
///
/// [`resize_with`]: MutBumpVec::resize_with
/// [`truncate`]: BumpBox::truncate
/// [`resize_with`]: Self::resize_with
/// [`truncate`]: Self::truncate
impl
do examples
/// ```
Expand Down Expand Up @@ -1689,20 +1689,20 @@ where
/// (e.g. by reading from a file) before marking the data as initialized using
/// the [`set_len`] method.
///
/// [`set_len`]: BumpBox::set_len
/// [`set_len`]: Self::set_len
///
/// Note that this is a low-level API, which should be used with care for
/// optimization purposes. If you need to append data to a `MutBumpVec`
/// you can use [`push`], [`extend`], `extend_from_slice`[`_copy`](MutBumpVec::extend_from_slice_copy)`/`[`_clone`](MutBumpVec::extend_from_within_clone),
/// `extend_from_within`[`_copy`](MutBumpVec::extend_from_within_copy)`/`[`_clone`](MutBumpVec::extend_from_within_clone), [`insert`], [`resize`] or
/// [`resize_with`], depending on your exact needs.
///
/// [`push`]: MutBumpVec::push
/// [`extend`]: MutBumpVec::extend
/// [`insert`]: MutBumpVec::insert
/// [`append`]: MutBumpVec::append
/// [`resize`]: MutBumpVec::resize
/// [`resize_with`]: MutBumpVec::resize_with
/// [`push`]: Self::push
/// [`extend`]: Self::extend
/// [`insert`]: Self::insert
/// [`append`]: Self::append
/// [`resize`]: Self::resize
/// [`resize_with`]: Self::resize_with
#[inline]
pub fn split_at_spare_mut(&mut self) -> (&mut [T], &mut [MaybeUninit<T>]) {
let ptr = self.as_mut_ptr();
Expand Down Expand Up @@ -2042,8 +2042,8 @@ where
///
/// If you need to use the `Bump(Scope)` while iterating you can first turn it to a slice with [`into_slice`] or [`into_boxed_slice`].
///
/// [`into_slice`]: MutBumpVec::into_slice
/// [`into_boxed_slice`]: MutBumpVec::into_boxed_slice
/// [`into_slice`]: Self::into_slice
/// [`into_boxed_slice`]: Self::into_boxed_slice
#[inline(always)]
fn into_iter(self) -> Self::IntoIter {
self.fixed.into_iter()
Expand Down
Loading

0 comments on commit afe1e2c

Please sign in to comment.