mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-10-02 14:54:30 +00:00
docs: modernize intra doc links
This commit is contained in:
parent
45517a50e9
commit
4799f8ce10
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@ -188,13 +188,14 @@ jobs:
|
|||||||
${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
|
${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
|
||||||
${{ runner.OS }}-build-
|
${{ runner.OS }}-build-
|
||||||
|
|
||||||
- name: Install stable Rust with target (${{ matrix.target }})
|
- name: Install nightly Rust with target (${{ matrix.target }})
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@nightly
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: cargo doc
|
- name: cargo rustdoc
|
||||||
run: cargo doc --target=${{ matrix.target }} --features="ufmt serde defmt-03 mpmc_large portable-atomic-critical-section"
|
env: {"RUSTDOCFLAGS": "-D warnings --cfg docsrs"}
|
||||||
|
run: cargo rustdoc --target=${{ matrix.target }} --features="ufmt serde defmt-03 mpmc_large portable-atomic-critical-section"
|
||||||
|
|
||||||
# Run cpass tests
|
# Run cpass tests
|
||||||
testcpass:
|
testcpass:
|
||||||
|
@ -51,4 +51,7 @@ defmt = { version = ">=0.2.0,<0.4", optional = true }
|
|||||||
ufmt = "0.2"
|
ufmt = "0.2"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
features = ["ufmt", "serde", "defmt-03", "mpmc_large", "portable-atomic-critical-section"]
|
||||||
|
# for the pool module
|
||||||
|
targets = ["i686-unknown-linux-gnu"]
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
@ -5,8 +5,6 @@ name = "cfail"
|
|||||||
publish = false
|
publish = false
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
heapless = { path = ".." }
|
heapless = { path = ".." }
|
||||||
trybuild = "1.0.18"
|
trybuild = "1.0.18"
|
||||||
|
@ -444,11 +444,8 @@ impl<'a, T> Hole<'a, T> {
|
|||||||
/// Structure wrapping a mutable reference to the greatest item on a
|
/// Structure wrapping a mutable reference to the greatest item on a
|
||||||
/// `BinaryHeap`.
|
/// `BinaryHeap`.
|
||||||
///
|
///
|
||||||
/// This `struct` is created by the [`peek_mut`] method on [`BinaryHeap`]. See
|
/// This `struct` is created by [`BinaryHeap::peek_mut`].
|
||||||
/// its documentation for more.
|
/// See its documentation for more.
|
||||||
///
|
|
||||||
/// [`peek_mut`]: struct.BinaryHeap.html#method.peek_mut
|
|
||||||
/// [`BinaryHeap`]: struct.BinaryHeap.html
|
|
||||||
pub struct PeekMut<'a, T, K, const N: usize>
|
pub struct PeekMut<'a, T, K, const N: usize>
|
||||||
where
|
where
|
||||||
T: Ord,
|
T: Ord,
|
||||||
|
@ -12,10 +12,10 @@ use hash32::{BuildHasherDefault, FnvHasher};
|
|||||||
|
|
||||||
use crate::Vec;
|
use crate::Vec;
|
||||||
|
|
||||||
/// A [`heapless::IndexMap`](./struct.IndexMap.html) using the default FNV hasher
|
/// A [`IndexMap`] using the default FNV hasher
|
||||||
///
|
///
|
||||||
/// A list of all Methods and Traits available for `FnvIndexMap` can be found in
|
/// A list of all Methods and Traits available for `FnvIndexMap` can be found in
|
||||||
/// the [`heapless::IndexMap`](./struct.IndexMap.html) documentation.
|
/// the [`IndexMap`] documentation.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
@ -478,15 +478,16 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fixed capacity [`IndexMap`](https://docs.rs/indexmap/1/indexmap/map/struct.IndexMap.html)
|
/// Fixed capacity [`IndexMap`](https://docs.rs/indexmap/2/indexmap/map/struct.IndexMap.html)
|
||||||
///
|
///
|
||||||
/// Note that you cannot use `IndexMap` directly, since it is generic around the hashing algorithm
|
/// Note that you cannot use `IndexMap` directly, since it is generic around the hashing algorithm
|
||||||
/// in use. Pick a concrete instantiation like [`FnvIndexMap`](./type.FnvIndexMap.html) instead
|
/// in use. Pick a concrete instantiation like [`FnvIndexMap`] instead
|
||||||
/// or create your own.
|
/// or create your own.
|
||||||
///
|
///
|
||||||
/// Note that the capacity of the `IndexMap` must be a power of 2.
|
/// Note that the capacity of the `IndexMap` must be a power of 2.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
|
///
|
||||||
/// Since `IndexMap` cannot be used directly, we're using its `FnvIndexMap` instantiation
|
/// Since `IndexMap` cannot be used directly, we're using its `FnvIndexMap` instantiation
|
||||||
/// for this example.
|
/// for this example.
|
||||||
///
|
///
|
||||||
@ -904,7 +905,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Same as [`swap_remove`](struct.IndexMap.html#method.swap_remove)
|
/// Same as [`swap_remove`](Self::swap_remove)
|
||||||
///
|
///
|
||||||
/// Computes in **O(1)** time (average).
|
/// Computes in **O(1)** time (average).
|
||||||
///
|
///
|
||||||
|
@ -7,10 +7,10 @@ use core::{
|
|||||||
};
|
};
|
||||||
use hash32::{BuildHasherDefault, FnvHasher};
|
use hash32::{BuildHasherDefault, FnvHasher};
|
||||||
|
|
||||||
/// A [`heapless::IndexSet`](./struct.IndexSet.html) using the
|
/// A [`IndexSet`] using the
|
||||||
/// default FNV hasher.
|
/// default FNV hasher.
|
||||||
/// A list of all Methods and Traits available for `FnvIndexSet` can be found in
|
/// A list of all Methods and Traits available for `FnvIndexSet` can be found in
|
||||||
/// the [`heapless::IndexSet`](./struct.IndexSet.html) documentation.
|
/// the [`IndexSet`] documentation.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
@ -41,10 +41,10 @@ use hash32::{BuildHasherDefault, FnvHasher};
|
|||||||
/// ```
|
/// ```
|
||||||
pub type FnvIndexSet<T, const N: usize> = IndexSet<T, BuildHasherDefault<FnvHasher>, N>;
|
pub type FnvIndexSet<T, const N: usize> = IndexSet<T, BuildHasherDefault<FnvHasher>, N>;
|
||||||
|
|
||||||
/// Fixed capacity [`IndexSet`](https://docs.rs/indexmap/1/indexmap/set/struct.IndexSet.html).
|
/// Fixed capacity [`IndexSet`](https://docs.rs/indexmap/2/indexmap/set/struct.IndexSet.html).
|
||||||
///
|
///
|
||||||
/// Note that you cannot use `IndexSet` directly, since it is generic around the hashing algorithm
|
/// Note that you cannot use `IndexSet` directly, since it is generic around the hashing algorithm
|
||||||
/// in use. Pick a concrete instantiation like [`FnvIndexSet`](./type.FnvIndexSet.html) instead
|
/// in use. Pick a concrete instantiation like [`FnvIndexSet`] instead
|
||||||
/// or create your own.
|
/// or create your own.
|
||||||
///
|
///
|
||||||
/// Note that the capacity of the `IndexSet` must be a power of 2.
|
/// Note that the capacity of the `IndexSet` must be a power of 2.
|
||||||
|
35
src/lib.rs
35
src/lib.rs
@ -43,19 +43,26 @@
|
|||||||
//!
|
//!
|
||||||
//! List of currently implemented data structures:
|
//! List of currently implemented data structures:
|
||||||
//!
|
//!
|
||||||
//! - [`Arc`](pool/arc/index.html) -- like `std::sync::Arc` but backed by a lock-free memory pool
|
#![cfg_attr(
|
||||||
//! rather than `#[global_allocator]`
|
any(arm_llsc, target_arch = "x86"),
|
||||||
//! - [`Box`](pool/boxed/index.html) -- like `std::boxed::Box` but backed by a lock-free memory pool
|
doc = "- [`Arc`](pool::arc::Arc) -- like `std::sync::Arc` but backed by a lock-free memory pool rather than `#[global_allocator]`"
|
||||||
//! rather than `#[global_allocator]`
|
)]
|
||||||
//! - [`BinaryHeap`](binary_heap/struct.BinaryHeap.html) -- priority queue
|
# -- hash table
|
any(arm_llsc, target_arch = "x86"),
|
||||||
//! - [`IndexSet`](struct.IndexSet.html) -- hash set
|
doc = "- [`Box`](pool::boxed::Box) -- like `std::boxed::Box` but backed by a lock-free memory pool rather than `#[global_allocator]`"
|
||||||
//! - [`LinearMap`](struct.LinearMap.html)
|
)]
|
||||||
//! - [`Object`](pool/object/index.html) -- objects managed by an object pool
|
//! - [`BinaryHeap`] -- priority queue
|
||||||
//! - [`String`](struct.String.html)
|
//! - [`IndexMap`] -- hash table
|
||||||
//! - [`Vec`](struct.Vec.html)
|
//! - [`IndexSet`] -- hash set
|
||||||
//! - [`mpmc::Q*`](mpmc/index.html) -- multiple producer multiple consumer lock-free queue
|
//! - [`LinearMap`]
|
||||||
//! - [`spsc::Queue`](spsc/struct.Queue.html) -- single producer single consumer lock-free queue
|
# -- objects managed by an object pool"
|
||||||
|
)]
|
||||||
|
//! - [`String`]
|
||||||
|
//! - [`Vec`]
|
||||||
|
//! - [`mpmc::Q*`](mpmc) -- multiple producer multiple consumer lock-free queue
|
||||||
|
//! - [`spsc::Queue`] -- single producer single consumer lock-free queue
|
||||||
//!
|
//!
|
||||||
//! # Optional Features
|
//! # Optional Features
|
||||||
//!
|
//!
|
||||||
@ -72,7 +79,7 @@
|
|||||||
//!
|
//!
|
||||||
//! In other words, changes in the Rust version requirement of this crate are not considered semver
|
//! In other words, changes in the Rust version requirement of this crate are not considered semver
|
||||||
//! breaking change and may occur in patch version releases.
|
//! breaking change and may occur in patch version releases.
|
||||||
|
#![cfg_attr(docsrs, feature(doc_cfg), feature(doc_auto_cfg))]
|
||||||
#![cfg_attr(not(test), no_std)]
|
#![cfg_attr(not(test), no_std)]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
@ -79,7 +79,7 @@ use super::treiber::{NonNullPtr, Stack, UnionNode};
|
|||||||
|
|
||||||
/// Creates a new `ArcPool` singleton with the given `$name` that manages the specified `$data_type`
|
/// Creates a new `ArcPool` singleton with the given `$name` that manages the specified `$data_type`
|
||||||
///
|
///
|
||||||
/// For more extensive documentation see the [module level documentation](pool/arc/index.html)
|
/// For more extensive documentation see the [module level documentation](crate::pool::arc)
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! arc_pool {
|
macro_rules! arc_pool {
|
||||||
($name:ident: $data_type:ty) => {
|
($name:ident: $data_type:ty) => {
|
||||||
|
@ -90,7 +90,7 @@ use super::treiber::{NonNullPtr, Stack, UnionNode};
|
|||||||
|
|
||||||
/// Creates a new `BoxPool` singleton with the given `$name` that manages the specified `$data_type`
|
/// Creates a new `BoxPool` singleton with the given `$name` that manages the specified `$data_type`
|
||||||
///
|
///
|
||||||
/// For more extensive documentation see the [module level documentation](pool/boxed/index.html)
|
/// For more extensive documentation see the [module level documentation](crate::pool::boxed)
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! box_pool {
|
macro_rules! box_pool {
|
||||||
($name:ident: $data_type:ty) => {
|
($name:ident: $data_type:ty) => {
|
||||||
|
@ -78,7 +78,7 @@ use super::treiber::{AtomicPtr, NonNullPtr, Stack, StructNode};
|
|||||||
/// Creates a new `ObjectPool` singleton with the given `$name` that manages the specified
|
/// Creates a new `ObjectPool` singleton with the given `$name` that manages the specified
|
||||||
/// `$data_type`
|
/// `$data_type`
|
||||||
///
|
///
|
||||||
/// For more extensive documentation see the [module level documentation](pool/object/index.html)
|
/// For more extensive documentation see the [module level documentation](crate::pool::object)
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! object_pool {
|
macro_rules! object_pool {
|
||||||
($name:ident: $data_type:ty) => {
|
($name:ident: $data_type:ty) => {
|
||||||
|
@ -232,8 +232,6 @@ impl<const N: usize> String<N> {
|
|||||||
|
|
||||||
/// Appends the given [`char`] to the end of this `String`.
|
/// Appends the given [`char`] to the end of this `String`.
|
||||||
///
|
///
|
||||||
/// [`char`]: ../../std/primitive.char.html
|
|
||||||
///
|
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
@ -274,8 +272,6 @@ impl<const N: usize> String<N> {
|
|||||||
///
|
///
|
||||||
/// Panics if `new_len` does not lie on a [`char`] boundary.
|
/// Panics if `new_len` does not lie on a [`char`] boundary.
|
||||||
///
|
///
|
||||||
/// [`char`]: ../../std/primitive.char.html
|
|
||||||
///
|
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
@ -302,8 +298,6 @@ impl<const N: usize> String<N> {
|
|||||||
///
|
///
|
||||||
/// Returns [`None`] if this `String` is empty.
|
/// Returns [`None`] if this `String` is empty.
|
||||||
///
|
///
|
||||||
/// [`None`]: ../../std/option/enum.Option.html#variant.None
|
|
||||||
///
|
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
|
19
src/vec.rs
19
src/vec.rs
@ -56,7 +56,7 @@ impl<T, const N: usize> Vec<T, N> {
|
|||||||
/// // allocate the vector in a static variable
|
/// // allocate the vector in a static variable
|
||||||
/// static mut X: Vec<u8, 16> = Vec::new();
|
/// static mut X: Vec<u8, 16> = Vec::new();
|
||||||
/// ```
|
/// ```
|
||||||
/// `Vec` `const` constructor; wrap the returned value in [`Vec`](../struct.Vec.html)
|
/// `Vec` `const` constructor; wrap the returned value in [`Vec`].
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
// Const assert N >= 0
|
// Const assert N >= 0
|
||||||
crate::sealed::greater_than_eq_0::<N>();
|
crate::sealed::greater_than_eq_0::<N>();
|
||||||
@ -307,7 +307,7 @@ impl<T, const N: usize> Vec<T, N> {
|
|||||||
/// difference, with each additional slot filled with value. If
|
/// difference, with each additional slot filled with value. If
|
||||||
/// new_len is less than len, the Vec is simply truncated.
|
/// new_len is less than len, the Vec is simply truncated.
|
||||||
///
|
///
|
||||||
/// See also [`resize_default`](struct.Vec.html#method.resize_default).
|
/// See also [`resize_default`](Self::resize_default).
|
||||||
pub fn resize(&mut self, new_len: usize, value: T) -> Result<(), ()>
|
pub fn resize(&mut self, new_len: usize, value: T) -> Result<(), ()>
|
||||||
where
|
where
|
||||||
T: Clone,
|
T: Clone,
|
||||||
@ -333,7 +333,7 @@ impl<T, const N: usize> Vec<T, N> {
|
|||||||
/// difference, with each additional slot filled with `Default::default()`.
|
/// difference, with each additional slot filled with `Default::default()`.
|
||||||
/// If `new_len` is less than `len`, the `Vec` is simply truncated.
|
/// If `new_len` is less than `len`, the `Vec` is simply truncated.
|
||||||
///
|
///
|
||||||
/// See also [`resize`](struct.Vec.html#method.resize).
|
/// See also [`resize`](Self::resize).
|
||||||
pub fn resize_default(&mut self, new_len: usize) -> Result<(), ()>
|
pub fn resize_default(&mut self, new_len: usize) -> Result<(), ()>
|
||||||
where
|
where
|
||||||
T: Clone + Default,
|
T: Clone + Default,
|
||||||
@ -348,17 +348,17 @@ impl<T, const N: usize> Vec<T, N> {
|
|||||||
/// is done using one of the safe operations instead, such as
|
/// is done using one of the safe operations instead, such as
|
||||||
/// [`truncate`], [`resize`], [`extend`], or [`clear`].
|
/// [`truncate`], [`resize`], [`extend`], or [`clear`].
|
||||||
///
|
///
|
||||||
/// [`truncate`]: #method.truncate
|
/// [`truncate`]: Self::truncate
|
||||||
/// [`resize`]: #method.resize
|
/// [`resize`]: Self::resize
|
||||||
/// [`extend`]: https://doc.rust-lang.org/stable/core/iter/trait.Extend.html#tymethod.extend
|
/// [`extend`]: core::iter::Extend
|
||||||
/// [`clear`]: #method.clear
|
/// [`clear`]: Self::clear
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `new_len` must be less than or equal to [`capacity()`].
|
/// - `new_len` must be less than or equal to [`capacity()`].
|
||||||
/// - The elements at `old_len..new_len` must be initialized.
|
/// - The elements at `old_len..new_len` must be initialized.
|
||||||
///
|
///
|
||||||
/// [`capacity()`]: #method.capacity
|
/// [`capacity()`]: Self::capacity
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -928,9 +928,6 @@ impl<T, const N: usize> FromIterator<T> for Vec<T, N> {
|
|||||||
/// An iterator that moves out of an [`Vec`][`Vec`].
|
/// An iterator that moves out of an [`Vec`][`Vec`].
|
||||||
///
|
///
|
||||||
/// This struct is created by calling the `into_iter` method on [`Vec`][`Vec`].
|
/// This struct is created by calling the `into_iter` method on [`Vec`][`Vec`].
|
||||||
///
|
|
||||||
/// [`Vec`]: (https://doc.rust-lang.org/std/vec/struct.Vec.html)
|
|
||||||
///
|
|
||||||
pub struct IntoIter<T, const N: usize> {
|
pub struct IntoIter<T, const N: usize> {
|
||||||
vec: Vec<T, N>,
|
vec: Vec<T, N>,
|
||||||
next: usize,
|
next: usize,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user