Bump rustdocs to use newer cross-linking capability.

This commit is contained in:
2025-01-20 14:15:50 -05:00
parent 60719c4ecb
commit 4cd221ae01
2 changed files with 45 additions and 62 deletions

View File

@@ -1,24 +1,22 @@
//! This crate provides support for search (in the sense of AI or optimization)
//! over a space of discrete, enumerated states. Its main data structure is
//! [Graph](struct.Graph.html), a directed graph with content-addressable
//! vertices. See [the documentation for that type](struct.Graph.html) for a
//! description of what information it holds (and why).
//! [`Graph`], a directed graph with content-addressable vertices. See [the
//! documentation for that type](struct.Graph.html) for a description of what
//! information it holds (and why).
//!
//! Several efficient, type-safe interfaces to `Graph` are also provided. You
//! will likely interact with a `Graph` through these interfaces:
//!
//! * [view](view/index.html) provides a type- and memory-safe view of a `Graph`.
//! * [nav](nav/index.html) provides a read-only cursor-based view of a
//! `Graph`. (If you have seen
//! [zippers](https://en.wikipedia.org/wiki/Zipper_(data_structure)) in other
//! contexts, this pattern should be familiar).
//! * [mutators](mutators/index.html) is a read-write analogue of `nav`.
//! * [`view`] provides a type- and memory-safe view of a `Graph`.
//! * [`nav`] provides a read-only cursor-based view of a `Graph`. (If you have
//! seen [zippers](https://en.wikipedia.org/wiki/Zipper_(data_structure)) in
//! other contexts, this pattern should be familiar).
//! * [`mutators`] is a read-write analogue of `nav`.
//!
//! Limited support for deletion of graph elements is available, in the form of
//! mark-and-compact garbage collection. See
//! [MutNode.retain_reachable](mutators/struct.MutNode.html#method.retain_reachable)
//! and
//! [View.retain_reachable_from](view/struct.View.html#method.retain_reachable_from).
//! [`crate::mutators::MutNode::retain_reachable`] and
//! [`view::View::retain_reachable_from`].
pub(crate) mod base;
pub(crate) mod mark_compact;
@@ -60,17 +58,13 @@ use symbol_map::SymbolId;
/// be, with some form of interior mutability. (You need *somewhere* to record
/// information during graph search!)
///
/// Cursors into the graph may be obtained with
/// [find_node](struct.Graph.html#method.find_node) or
/// [find_node_mut](struct.Graph.html#method.find_node_mut). Or you can pass it
/// to [`view::of_graph`](view/fn.of_graph.html) and operate on it via the
/// [`View`](view/struct.View.html) API.
/// Cursors into the graph may be obtained with [`Graph::find_node`] or
/// [`Graph::find_node_mut`]. Or you can pass it to [`view::of_graph`] and
/// operate on it via the [`view::View`] API.
///
/// Content can be added to a `Graph` directly with the
/// [add_node](struct.Graph.html#method.add_node) and
/// [add_edge](struct.Graph.html#method.add_edge) methods. It may also be added
/// through the interfaces provided by the [mutators](mutators/index.html) and
/// [view](view/index.html) modules.
/// Content can be added to a `Graph` directly with [`Graph::add_node`] and
/// [`Graph::add_edge`]. It may also be added through the interfaces provided by
/// the [`mutators`] and [`view`] modules.
pub struct Graph<T: Hash + Eq + Clone, S, A> {
/// Lookup table that maps from game states to `VertexId`.
state_ids: symbol_map::indexing::HashIndexing<T, VertexId>,

View File

@@ -1,29 +1,24 @@
//! Provides an editable view of both graph topology and data, while
//! simultaneously allowing multiple live references into the graph.
//!
//! References into the graph are provided by [NodeRef](struct.NodeRef.html) and
//! [EdgeRef](struct.EdgeRef.html). You may have multiple `NodeRef`s and
//! `EdgeRef`s pointing into the same `View` at any time, without running into
//! restrictions from the borrow checker.
//! References into the graph are provided by [`NodeRef`] and [`EdgeRef`]. You
//! may have multiple `NodeRef`s and `EdgeRef`s pointing into the same [`View`]
//! at any time, without running into restrictions from the borrow checker.
//!
//! To make use of these references, pass them to their respective methods on
//! the `View` that they came from (like
//! [node_state](struct.View.html#method.node_state),
//! [node_data_mut](struct.View.html#method.node_data),
//! [edge_data_mut](struct.View.html#edge_data_mut), and
//! [edge_target](struct.View.html#edge_target)).
//! the `View` that they came from (like [`View::node_state`],
//! [`View::node_data_mut`], [`View::edge_data_mut`], and
//! [`View::edge_target`]).
//!
//! These references are created with respect to a [View](struct.View.html),
//! which wraps around a mutable borrow of a [Graph](../struct.Graph.html). They
//! may only be dereferenced with respect to the view that created them, and
//! operations on a `View` that would invalidate these references consume the
//! `View`.
//! These references are created with respect to a [`View`], which wraps around
//! a mutable borrow of a [`crate::Graph`]. They may only be dereferenced with
//! respect to the view that created them, and operations on a `View` that would
//! invalidate these references consume the `View`.
//!
//! # Basic usage
//!
//! To create a `View`, use one of the functions defined in this module:
//! [of_graph](fn.of_graph.html), [of_node](fn.of_node.html), or
//! [of_edge](fn.of_edge.html).
//! [`of_graph`], [`of_node`], or [`of_edge`].
//!
//! To use a `NodeRef` or `EdgeRef` with a `View`, pass the reference to an
//! appropriate function on the `View` or index into the `View` directly:
@@ -46,17 +41,15 @@
//!
//! # Relationship with `search_graph::mutators`
//!
//! The [mutators](../mutators/index.html) module provides another read-write
//! interface to a `Graph`, in which cursors into the graph directly own a
//! mutable reference to it. Because these cursors own a mutable reference to a
//! common underlying `Graph`, it is difficult to have more than one cursor
//! active at a time while still satisfying the borrow checker. This makes it
//! tricky to retain multiple cursors into a graph if even one of them allows
//! the graph to be mutated.
//! The [`crate::mutators`] module provides another read-write interface to a
//! `Graph`, in which cursors into the graph directly own a mutable reference to
//! it. Because these cursors own a mutable reference to a common underlying
//! `Graph`, it is difficult to have more than one cursor active at a time while
//! still satisfying the borrow checker. This makes it tricky to retain multiple
//! cursors into a graph if even one of them allows the graph to be mutated.
//!
//! The cursors in `mutators` may be converted into a `View` by the
//! [of_node](fn.of_node.html) and [of_edge](fn.of_edge.html) functions. For
//! example:
//! The cursors in `mutators` may be converted into a `View` by the [`of_node`]
//! and [`of_edge`] functions. For example:
//!
//! ```rust
//! # use search_graph::Graph;
@@ -73,12 +66,9 @@
//! ```
//!
//! A `View` may be transformed into a cursor from `mutators` by calling
//! [into_node](struct.View.html#method.into_node),
//! [into_edge](struct.View.html#method.into_edge),
//! [into_append_node](struct.View.html#method.into_append_node) or
//! [into_append_edge](struct.View.html#method.into_append_edge). These methods
//! consume a `View` and release its borrow of a `Graph` back to a stand-alone
//! cursor type. For example:
//! [`View::into_node`], [`View::into_edge`], [`View::into_append_node`] or
//! [`View::into_append_edge`]. These methods consume a `View` and release its
//! borrow of a `Graph` back to a stand-alone cursor type. For example:
//!
//! ```rust
//! # use search_graph::Graph;
@@ -128,8 +118,7 @@ where
lifetime: InvariantLifetime<'id>,
}
/// Applies a function over a view of [Graph](../struct.Graph.html) and returns
/// its result.
/// Applies a function over a view of [`crate::Graph`] and returns its result.
///
/// ```rust
/// # use search_graph::Graph;
@@ -163,8 +152,8 @@ pub fn of_graph<
})
}
/// Applies a function over a [MutNode](../mutators/struct.MutNode.html) and a
/// view of its containing graph and returns the function's result.
/// Applies a function over a [`crate::mutators::MutNode`] and a view of its
/// containing graph and returns the function's result.
///
/// ```rust
/// # use search_graph::Graph;
@@ -201,8 +190,8 @@ pub fn of_node<
)
}
/// Applies a function over a [MutEdge](../mutators/struct.MutEdge.html) and a
/// view of its containing graph and returns the function's result.
/// Applies a function over a [`crate::mutators::MutEdge`] and a view of its
/// containing graph and returns the function's result.
///
/// ```rust
/// # use search_graph::Graph;
@@ -646,8 +635,8 @@ impl<'id> fmt::Debug for NodeRef<'id> {
/// });
/// ```
///
/// As with [NodeRef](struct.NodeRef.html), an `EdgeRef` can only be used with
/// the [View](struct.View.html) for which it was generated:
/// As with [`NodeRef`], an `EdgeRef` can only be used with the [`View`] for
/// which it was generated:
///
/// ```compile_fail
/// # use search_graph::Graph;