From 8ec7c84e117bd24170a0a69c8d7b1b334f6c1b35 Mon Sep 17 00:00:00 2001 From: Luca Mondada Date: Fri, 28 Jul 2023 09:17:55 +0200 Subject: [PATCH] Improve type params docs --- src/algorithms/toposort.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/algorithms/toposort.rs b/src/algorithms/toposort.rs index 0d197d6..6d17d13 100644 --- a/src/algorithms/toposort.rs +++ b/src/algorithms/toposort.rs @@ -4,6 +4,10 @@ use std::{collections::VecDeque, fmt::Debug, iter::FusedIterator}; /// Returns an iterator over a [`LinkView`] in topological order. /// +/// ## Type parameters +/// - `G`: The graph type implementing [`LinkView`], +/// - `Map`: Internal workspace for graph traversal (see below). +/// /// The `Map` type parameter specifies the type of the secondary map that is /// used to store the dominator tree data. The default is [`BitVec`], which is /// efficient for full graph traversal, i.e. when all nodes are reachable from @@ -26,11 +30,11 @@ use std::{collections::VecDeque, fmt::Debug, iter::FusedIterator}; /// let topo: TopoSort<_> = toposort(&graph, [node_a], Direction::Outgoing); /// assert_eq!(topo.collect::>(), [node_a, node_b]); /// ``` -pub fn toposort<'f, Map, G: LinkView>( +pub fn toposort( graph: G, source: impl IntoIterator, direction: Direction, -) -> TopoSort<'f, G, Map> +) -> TopoSort<'static, G, Map> where Map: SecondaryMap, { @@ -43,6 +47,11 @@ where /// /// If the filter closures return false for a node or port, it is skipped. /// +/// ## Type parameters +/// - `'f`: The lifetime of the filter closures, +/// - `G`: The graph type implementing [`LinkView`], +/// - `Map`: Internal workspace for graph traversal (see below). +/// /// The `Map` type parameter specifies the type of the secondary map that is /// used to store the dominator tree data. The default is [`BitVec`], which is /// efficient for full graph traversal, i.e. when all nodes are reachable from @@ -75,7 +84,7 @@ where /// ); /// assert_eq!(topo.collect::>(), [node_a, node_b]); /// ``` -pub fn toposort_filtered<'f, Map, G>( +pub fn toposort_filtered<'f, G, Map>( graph: G, source: impl IntoIterator, direction: Direction,