NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io
crates.io, #1890 most downloaded on crates.io
Performs topological sorting.
Latest stable
0.3.1
Last release 3 months ago
07 Aug 2026
Ships unpredictably
gaps range from 4 weeks to 4.5 years
Nearly every release is documented
notes for 16 of 16 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
16 releases · first in 2015
Drag across the ruler to compare, or tap a release to open it.
## What's Changed ### Fixed * Fixed broken links in README. Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.3.0...v0.3.1
Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.3.0...v0.3.1
(Breaking Change) TopologicalSort::add_dependency() and TopologicalSort::add_link() now return true when they add a new dependency link and false when…
TopologicalSort::items() and TopologicalSort::into_items() to iterate over all remaining items, including ones that are still blocked by unresolved dependencies or cycles. (#70 by @gifnksm)Extend<DependencyLink<T>> for TopologicalSort<T>, allowing dependency links to be appended with extend(). (#63 by @gifnksm)TopologicalSort::pop_iter(), which returns a PopIter<'_, T> that repeatedly calls pop(). (#64 by @gifnksm)TopologicalSort::pop_batch(), which removes and returns the current batch of ready items and can collect into any collection implementing Default + Extend<T>. (#66, #71 by @gifnksm)TopologicalSort::peek_batch(), which iterates over the current batch of ready items. (#66, #71 by @gifnksm)TopologicalSort::remove(), which removes a specified item only when it has no remaining dependencies. (#68 by @gifnksm)CHANGELOG.md. (#51 by @gifnksm)TopologicalSort::add_dependency() and TopologicalSort::add_link() now return true when they add a new dependency link and false when that link already existed. (#39 by @szabgab)TopologicalSort<T> debug output to use a more collection-like representation of dependency relationships. (#58 by @gifnksm)#[must_use] to TopologicalSort::new(), len(), is_empty(), peek(), and peek_batch(), which may produce new warnings when their return values are ignored.TopologicalSort::pop_all() in favor of TopologicalSort::pop_batch(). (#66, #72 by @gifnksm)
Rationale:
The old name could be taken to mean that the method would keep popping items until no more progress was possible.
However, it only removed the current batch of items that had no remaining dependencies at the time of the call.
The new name makes that batch-oriented behavior explicit and helps avoid using a single pop_all() call as a cycle check.
pop_batch() also avoids unnecessary intermediate collection work.
Callers can now collect directly into their chosen container instead of always receiving a Vec.
Migration notes:
ts.pop_all() with ts.pop_batch::<Vec<_>>() when you still want a Vec.ts.pop_iter() instead, for example let items: Vec<_> = ts.pop_iter().collect();.TopologicalSort::peek_all() in favor of TopologicalSort::peek_batch(). (#66, #72 by @gifnksm)
Rationale: The old name could be taken to mean that the method would inspect every item that would become ready as popping progressed. However, it only inspected the current batch of items that had no remaining dependencies at the time of the call. The new name makes that batch-oriented behavior explicit.
peek_batch() also avoids unnecessary allocation when callers only need to inspect or stream the ready items.
Migration notes:
ts.peek_all() with ts.peek_batch().collect::<Vec<_>>() when you still want Vec<&T>.peek_batch(), use ts.peek_batch().copied().collect::<Vec<_>>() for Copy types or ts.peek_batch().cloned().collect::<Vec<_>>() for Clone types.impl From<(T, T)> for DependencyLink<T>. (#57 by @gifnksm)
TopologicalSort::add_dependency(prec, succ) and DependencyLink { prec, succ }, which made it easy to invert a dependency link by mistake.ts.add_link((succ, prec).into()) with ts.add_link(DependencyLink { prec, succ }).DependencyLink::from((succ, prec)) with DependencyLink { prec, succ }..map(DependencyLink::from) on (succ, prec) tuples with .map(|(succ, prec)| DependencyLink { prec, succ }).impl FromIterator<T> for TopologicalSort<T>. (#61 by @ginksm)
TopologicalSort::from_iter(iter) or iter.collect::<TopologicalSort<T>>() compared each item with all previously seen items using partial_cmp() and inferred dependency links from every comparable pair.
That behavior was not intuitive for from_iter(), which readers could reasonably expect to just gather items or to derive relationships only from something more local such as adjacent pairs.
It also made from_iter() unexpectedly O(n^2) instead of the O(n) work that a collection-style operation usually suggests.items.into_iter().collect::<TopologicalSort<_>>().partial_cmp() defines a total order for your values and you only needed to iterate them in order, collect them into a Vec and sort it directly instead of using TopologicalSort.TopologicalSort::new() plus insert(), add_dependency(), and/or add_link().impl Iterator for TopologicalSort<T>. (#64 by @gifnksm)
Destructive iteration now requires an explicit TopologicalSort::pop_iter() call.
TopologicalSort removes items from the sort.
Implementing Iterator for TopologicalSort exposed methods such as count(), find(), and filter() directly on the sort itself.
On TopologicalSort, those methods look like inspection or search operations, even though calling them could destructively advance or consume the sort.
Requiring pop_iter() makes that destructive step explicit.ts.next() with ts.pop() when consuming one item at a time.TopologicalSort itself with ts.pop_iter().TopologicalSort with calls on ts.pop_iter() instead.Add Cargo lockfile by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/32
Fix license statements by @vladh in https://github.com/gifnksm/topological-sort-rs/pull/33
Address clippy lints by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/34
[test] the add_link method by @szabgab in https://github.com/gifnksm/topological-sort-rs/pull/37
[test] item that depends on itself by @szabgab in https://github.com/gifnksm/topological-sort-rs/pull/41
Drop unused_results lint by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/50
Refresh project tooling and automation by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/52
Clean up lib.rs formatting by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/54
Adopt Rust 2024 edition by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/55
Add Cargo keywords and categories by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/56
Clarify test names by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/59
Strengthen linting and add must_use annotations by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/60
Fix missed inline trait bounds by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/62
Rename internal nodes by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/65
Move example to crate-level docs by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/67
Use extract_if in ready-node removal paths by @gifnksm in https://github.com/gifnksm/topological-sort-rs/pull/69
<details> <summary>Dependency updates</summary>
</details>
Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.2.2...v0.3.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Marked the crate as passively maintained.
Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.2.1...v0.2.2
Fixed the manifest to use the supported rust-version key for declaring the MSRV.
rust-version key for declaring the MSRV.Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.2.0...v0.2.1
Implemented Default for TopologicalSort , allowing construction with TopologicalSort::default(). (#20 by @gifnksm)
Default for TopologicalSort<T>, allowing construction with TopologicalSort::default(). (#20 by @gifnksm)Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.1.0...v0.2.0
Default for TopologicalSort<T>, allowing construction with TopologicalSort::default().Updated CI configuration and made ignored return values explicit to satisfy newer Rust warnings. (#16 by @gifnksm)
Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.10...v0.1.0
Changed TopologicalSort::insert() and TopologicalSort::add_dependency() to accept arguments implementing Into . (#14 by @mathstuf)
TopologicalSort::insert() and TopologicalSort::add_dependency() to accept arguments implementing Into<T>. (#14 by @mathstuf)Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.9...v0.0.10
Added the DependencyLink type and TopologicalSort::add_link() for registering dependency edges as values. (#11 by @mathstuf)
DependencyLink<T> type and TopologicalSort::add_link() for registering dependency edges as values. (#11 by @mathstuf)From<(T, T)> for DependencyLink<T>, allowing dependency links to be created from tuples. (#11 by @mathstuf)FromIterator<DependencyLink<T>> for TopologicalSort<T>, allowing a sorter to be built from an iterator of dependency links. (#11 by @mathstuf)Clone for TopologicalSort<T> and Copy, Clone, and Debug for DependencyLink<T>. (#13 by @gifnksm)travis-cargo helpers to direct Cargo commands.Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.8...v0.0.9
DependencyLink<T> type and TopologicalSort::add_link() for registering dependency edges as values.From<(T, T)> for DependencyLink<T>, allowing dependency links to be created from tuples.FromIterator<DependencyLink<T>> for TopologicalSort<T>, allowing a sorter to be built from an iterator of dependency links.Clone for TopologicalSort<T> and Copy, Clone, and Debug for DependencyLink<T>.travis-cargo helpers to direct Cargo commands.Implemented fmt::Debug for TopologicalSort . (#7 by @purpleposeidon)
fmt::Debug for TopologicalSort<T>. (#7 by @purpleposeidon)TopologicalSort::peek() and TopologicalSort::peek_all() to inspect items that are ready to pop without removing them. (#7 by @purpleposeidon)Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.7...v0.0.8
Added TopologicalSort::insert() to register elements that have no dependencies. (#6 by @fenhl)
TopologicalSort::insert() to register elements that have no dependencies. (#6 by @fenhl)FromIterator<T> for partially ordered element types, deriving dependency edges from partial_cmp(). (#6 by @fenhl)Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.6...v0.0.7
Added Apache-2.0 as an alternative license alongside MIT.
topological_sort in code and documentation.travis-cargo, expanded testing to nightly, beta, and stable Rust, and enabled documentation and coverage reporting.topological_sort crate name.Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.5...v0.0.6
Updated the crate for rustc 1.0.0-nightly (199bdcfef 2015-03-26).
rustc 1.0.0-nightly (199bdcfef 2015-03-26).
std_misc feature gate.Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.4...v0.0.5
Updated the crate for rustc 1.0.0-nightly (522d09dfe 2015-02-19).
rustc 1.0.0-nightly (522d09dfe 2015-02-19).
Hash.std_misc feature gate.Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.3...v0.0.4
(Breaking Change) Changed TopologicalSort::len() to return usize instead of uint.
rustc 1.0.0-dev (20bce4481 2015-01-09 04:14:53 +0000).
TopologicalSort::len() to return usize instead of uint.TopologicalSort<T> and its Iterator implementation from Hash to Hash<Hasher>.Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.2...v0.0.3
Updated the crate for rustc 1.0.0-dev (9e4e524e0 2015-01-07 05:31:23 +0000).
rustc 1.0.0-dev (9e4e524e0 2015-01-07 05:31:23 +0000).
associated_types feature gate after associated types no longer required opting in.Full Changelog: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.1...v0.0.2
* First release Full Changelog: https://github.com/gifnksm/topological-sort-rs/commits/v0.0.1
Full Changelog: https://github.com/gifnksm/topological-sort-rs/commits/v0.0.1
<!-- next-url --> [Unreleased]: https://github.com/gifnksm/topological-sort-rs/compare/v0.3.1...HEAD [0.3.1]: https://github.com/gifnksm/topological-sort-rs/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/gifnksm/topological-sort-rs/compare/v0.2.2...v0.3.0 [0.2.2]: https://github.com/gifnksm/topological-sort-rs/compare/v0.2.1...v0.2.2 [0.2.1]: https://github.com/gifnksm/topological-sort-rs/compare/v0.2.0...v0.2.1 [0.2.0]: https://github.com/gifnksm/topological-sort-rs/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.10...v0.1.0 [0.0.10]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.9...v0.0.10 [0.0.9]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.8...v0.0.9 [0.0.8]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.7...v0.0.8 [0.0.7]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.6...v0.0.7 [0.0.6]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.5...v0.0.6 [0.0.5]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.4...v0.0.5 [0.0.4]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.3...v0.0.4 [0.0.3]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.2...v0.0.3 [0.0.2]: https://github.com/gifnksm/topological-sort-rs/compare/v0.0.1...v0.0.2 [0.0.1]: https://github.com/gifnksm/topological-sort-rs/releases/tag/v0.0.1
One column per quarter.