Skip to content

Commit

Permalink
Update lots of doc links to use item paths instead of file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
LikeLakers2 committed Jan 1, 2025
1 parent d179ea9 commit e302cd1
Show file tree
Hide file tree
Showing 60 changed files with 184 additions and 283 deletions.
8 changes: 4 additions & 4 deletions rayon-core/src/broadcast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ mod test;
/// within that threadpool. When the call has completed on each thread, returns
/// a vector containing all of their return values.
///
/// For more information, see the [`ThreadPool::broadcast()`][m] method.
/// For more information, see the [`ThreadPool::broadcast()`] method.
///
/// [m]: struct.ThreadPool.html#method.broadcast
/// [`ThreadPool::broadcast()`]: crate::ThreadPool::broadcast()
pub fn broadcast<OP, R>(op: OP) -> Vec<R>
where
OP: Fn(BroadcastContext<'_>) -> R + Sync,
Expand All @@ -30,9 +30,9 @@ where
/// current stack frame -- therefore, it cannot capture any references onto the
/// stack (you will likely need a `move` closure).
///
/// For more information, see the [`ThreadPool::spawn_broadcast()`][m] method.
/// For more information, see the [`ThreadPool::spawn_broadcast()`] method.
///
/// [m]: struct.ThreadPool.html#method.spawn_broadcast
/// [`ThreadPool::spawn_broadcast()`]: crate::ThreadPool::spawn_broadcast()
pub fn spawn_broadcast<OP>(op: OP)
where
OP: Fn(BroadcastContext<'_>) + Send + Sync + 'static,
Expand Down
35 changes: 12 additions & 23 deletions rayon-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,22 @@
//!
//! These APIs have been mirrored in the Rayon crate and it is recommended to use these from there.
//!
//! [`join`] is used to take two closures and potentially run them in parallel.
//! [`join()`] is used to take two closures and potentially run them in parallel.
//! - It will run in parallel if task B gets stolen before task A can finish.
//! - It will run sequentially if task A finishes before task B is stolen and can continue on task B.
//!
//! [`scope`] creates a scope in which you can run any number of parallel tasks.
//! [`scope()`] creates a scope in which you can run any number of parallel tasks.
//! These tasks can spawn nested tasks and scopes, but given the nature of work stealing, the order of execution can not be guaranteed.
//! The scope will exist until all tasks spawned within the scope have been completed.
//!
//! [`spawn`] add a task into the 'static' or 'global' scope, or a local scope created by the [`scope()`] function.
//! [`spawn()`] add a task into the 'static' or 'global' scope, or a local scope created by the [`scope()`] function.
//!
//! [`ThreadPool`] can be used to create your own thread pools (using [`ThreadPoolBuilder`]) or to customize the global one.
//! Tasks spawned within the pool (using [`install()`], [`join()`], etc.) will be added to a deque,
//! Tasks spawned within the pool (using [`install()`][tpinstall], [`join()`][tpjoin], etc.) will be added to a deque,
//! where it becomes available for work stealing from other threads in the local threadpool.
//!
//! [`join`]: fn.join.html
//! [`scope`]: fn.scope.html
//! [`scope()`]: fn.scope.html
//! [`spawn`]: fn.spawn.html
//! [`ThreadPool`]: struct.threadpool.html
//! [`install()`]: struct.ThreadPool.html#method.install
//! [`spawn()`]: struct.ThreadPool.html#method.spawn
//! [`join()`]: struct.ThreadPool.html#method.join
//! [`ThreadPoolBuilder`]: struct.ThreadPoolBuilder.html
//! [tpinstall]: ThreadPool::install()
//! [tpjoin]: ThreadPool::join()
//!
//! # Global fallback when threading is unsupported
//!
Expand Down Expand Up @@ -139,7 +132,7 @@ pub fn max_num_threads() -> usize {
/// number may vary over time in future versions (see [the
/// `num_threads()` method for details][snt]).
///
/// [snt]: struct.ThreadPoolBuilder.html#method.num_threads
/// [snt]: ThreadPoolBuilder::num_threads
pub fn current_num_threads() -> usize {
crate::registry::Registry::current_num_threads()
}
Expand Down Expand Up @@ -173,8 +166,7 @@ enum ErrorKind {
/// rayon::ThreadPoolBuilder::new().num_threads(22).build_global().unwrap();
/// ```
///
/// [`ThreadPool`]: struct.ThreadPool.html
/// [`build_global()`]: struct.ThreadPoolBuilder.html#method.build_global
/// [`build_global()`]: Self::build_global()
pub struct ThreadPoolBuilder<S = DefaultSpawn> {
/// The number of threads in the rayon thread pool.
/// If zero will use the RAYON_NUM_THREADS environment variable.
Expand Down Expand Up @@ -210,8 +202,6 @@ pub struct ThreadPoolBuilder<S = DefaultSpawn> {
}

/// Contains the rayon thread pool configuration. Use [`ThreadPoolBuilder`] instead.
///
/// [`ThreadPoolBuilder`]: struct.ThreadPoolBuilder.html
#[deprecated(note = "Use `ThreadPoolBuilder`")]
#[derive(Default)]
pub struct Configuration {
Expand Down Expand Up @@ -295,11 +285,11 @@ impl ThreadPoolBuilder {
/// Creates a scoped `ThreadPool` initialized using this configuration.
///
/// This is a convenience function for building a pool using [`std::thread::scope`]
/// to spawn threads in a [`spawn_handler`](#method.spawn_handler).
/// to spawn threads in a [`spawn_handler`].
/// The threads in this pool will start by calling `wrapper`, which should
/// do initialization and continue by calling `ThreadBuilder::run()`.
///
/// [`std::thread::scope`]: https://doc.rust-lang.org/std/thread/fn.scope.html
/// [`spawn_handler`]: Self::spawn_handler()
///
/// # Examples
///
Expand Down Expand Up @@ -409,10 +399,10 @@ impl<S> ThreadPoolBuilder<S> {
///
/// This can also be used for a pool of scoped threads like [`crossbeam::scope`],
/// or [`std::thread::scope`] introduced in Rust 1.63, which is encapsulated in
/// [`build_scoped`](#method.build_scoped).
/// [`build_scoped`].
///
/// [`crossbeam::scope`]: https://docs.rs/crossbeam/0.8/crossbeam/fn.scope.html
/// [`std::thread::scope`]: https://doc.rust-lang.org/std/thread/fn.scope.html
/// [`build_scoped`]: Self::build_scoped()
///
/// ```
/// # use rayon_core as rayon;
Expand Down Expand Up @@ -624,7 +614,6 @@ impl<S> ThreadPoolBuilder<S> {
/// [`scope_fifo()`] for a similar effect.
///
/// [RFC #1]: https://github.com/rayon-rs/rfcs/blob/main/accepted/rfc0001-scope-scheduling.md
/// [`scope_fifo()`]: fn.scope_fifo.html
#[deprecated(note = "use `scope_fifo` and `spawn_fifo` for similar effect")]
pub fn breadth_first(mut self) -> Self {
self.breadth_first = true;
Expand Down
3 changes: 1 addition & 2 deletions rayon-core/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Once};
use std::thread;

/// Thread builder used for customization via
/// [`ThreadPoolBuilder::spawn_handler`](struct.ThreadPoolBuilder.html#method.spawn_handler).
/// Thread builder used for customization via [`ThreadPoolBuilder::spawn_handler()`].
pub struct ThreadBuilder {
name: Option<String>,
stack_size: Option<usize>,
Expand Down
19 changes: 4 additions & 15 deletions rayon-core/src/scope/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//! Methods for custom fork-join scopes, created by the [`scope()`]
//! and [`in_place_scope()`] functions. These are a more flexible alternative to [`join()`].
//!
//! [`scope()`]: fn.scope.html
//! [`in_place_scope()`]: fn.in_place_scope.html
//! [`join()`]: ../join/join.fn.html
//! [`join()`]: crate::join()
use crate::broadcast::BroadcastContext;
use crate::job::{ArcJob, HeapJob, JobFifo, JobRef};
Expand All @@ -23,17 +21,13 @@ mod test;

/// Represents a fork-join scope which can be used to spawn any number of tasks.
/// See [`scope()`] for more information.
///
///[`scope()`]: fn.scope.html
pub struct Scope<'scope> {
base: ScopeBase<'scope>,
}

/// Represents a fork-join scope which can be used to spawn any number of tasks.
/// Those spawned from the same thread are prioritized in relative FIFO order.
/// See [`scope_fifo()`] for more information.
///
///[`scope_fifo()`]: fn.scope_fifo.html
pub struct ScopeFifo<'scope> {
base: ScopeBase<'scope>,
fifos: Vec<JobFifo>,
Expand Down Expand Up @@ -180,8 +174,6 @@ struct ScopeBase<'scope> {
/// "stale" tasks. For an alternate approach, consider
/// [`scope_fifo()`] instead.
///
/// [`scope_fifo()`]: fn.scope_fifo.html
///
/// # Accessing stack data
///
/// In general, spawned tasks may access stack data in place that
Expand Down Expand Up @@ -305,8 +297,6 @@ where
/// Tasks in a `scope_fifo()` run similarly to [`scope()`], but there's a
/// difference in the order of execution. Consider a similar example:
///
/// [`scope()`]: fn.scope.html
///
/// ```rust
/// # use rayon_core as rayon;
/// // point start
Expand Down Expand Up @@ -360,7 +350,7 @@ where
///
/// For more details on this design, see Rayon [RFC #1].
///
/// [`breadth_first`]: struct.ThreadPoolBuilder.html#method.breadth_first
/// [`breadth_first`]: crate::ThreadPoolBuilder::breadth_first
/// [RFC #1]: https://github.com/rayon-rs/rfcs/blob/main/accepted/rfc0001-scope-scheduling.md
///
/// # Panics
Expand Down Expand Up @@ -515,7 +505,7 @@ impl<'scope> Scope<'scope> {
/// The [`scope` function] has more extensive documentation about
/// task spawning.
///
/// [`scope` function]: fn.scope.html
/// [`scope` function]: scope()
pub fn spawn<BODY>(&self, body: BODY)
where
BODY: FnOnce(&Scope<'scope>) + Send + 'scope,
Expand Down Expand Up @@ -574,8 +564,7 @@ impl<'scope> ScopeFifo<'scope> {
/// priority. The [`scope_fifo` function] has more details about
/// this distinction.
///
/// [`Scope::spawn()`]: struct.Scope.html#method.spawn
/// [`scope_fifo` function]: fn.scope_fifo.html
/// [`scope_fifo` function]: scope_fifo()
pub fn spawn_fifo<BODY>(&self, body: BODY)
where
BODY: FnOnce(&ScopeFifo<'scope>) + Send + 'scope,
Expand Down
22 changes: 11 additions & 11 deletions rayon-core/src/spawn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use std::sync::Arc;
/// tied to the current stack frame, and hence it cannot hold any
/// references other than those with `'static` lifetime. If you want
/// to spawn a task that references stack data, use [the `scope()`
/// function][scope] to create a scope.
/// function] to create a scope.
///
/// [scope]: fn.scope.html
/// [the `scope()` function]: crate::scope()
///
/// Since tasks spawned with this function cannot hold references into
/// the enclosing stack frame, you almost certainly want to use a
Expand All @@ -32,16 +32,14 @@ use std::sync::Arc;
/// threads can steal older "stale" tasks. For an alternate approach,
/// consider [`spawn_fifo()`] instead.
///
/// [`spawn_fifo()`]: fn.spawn_fifo.html
///
/// # Panic handling
///
/// If this closure should panic, the resulting panic will be
/// propagated to the panic handler registered in the `ThreadPoolBuilder`,
/// if any. See [`ThreadPoolBuilder::panic_handler()`][ph] for more
/// if any. See [`ThreadPoolBuilder::panic_handler()`] for more
/// details.
///
/// [ph]: struct.ThreadPoolBuilder.html#method.panic_handler
/// [`ThreadPoolBuilder::panic_handler()`]: crate::ThreadPoolBuilder::panic_handler()
///
/// # Examples
///
Expand Down Expand Up @@ -106,27 +104,29 @@ where
/// tied to the current stack frame, and hence it cannot hold any
/// references other than those with `'static` lifetime. If you want
/// to spawn a task that references stack data, use [the `scope_fifo()`
/// function](fn.scope_fifo.html) to create a scope.
/// function] to create a scope.
///
/// The behavior is essentially the same as [the `spawn`
/// function](fn.spawn.html), except that calls from the same thread
/// function], except that calls from the same thread
/// will be prioritized in FIFO order. This is similar to the now-
/// deprecated [`breadth_first`] option, except the effect is isolated
/// to relative `spawn_fifo` calls, not all threadpool tasks.
///
/// For more details on this design, see Rayon [RFC #1].
///
/// [`breadth_first`]: struct.ThreadPoolBuilder.html#method.breadth_first
/// [the `scope_fifo()` function]: crate::scope_fifo()
/// [the `spawn` function]: crate::spawn()
/// [`breadth_first`]: crate::ThreadPoolBuilder::breadth_first
/// [RFC #1]: https://github.com/rayon-rs/rfcs/blob/main/accepted/rfc0001-scope-scheduling.md
///
/// # Panic handling
///
/// If this closure should panic, the resulting panic will be
/// propagated to the panic handler registered in the `ThreadPoolBuilder`,
/// if any. See [`ThreadPoolBuilder::panic_handler()`][ph] for more
/// if any. See [`ThreadPoolBuilder::panic_handler()`] for more
/// details.
///
/// [ph]: struct.ThreadPoolBuilder.html#method.panic_handler
/// [`ThreadPoolBuilder::panic_handler()`]: crate::ThreadPoolBuilder::panic_handler
pub fn spawn_fifo<F>(func: F)
where
F: FnOnce() + Send + 'static,
Expand Down
Loading

0 comments on commit e302cd1

Please sign in to comment.