Skip to content

v2.0.0

Choose a tag to compare

@gmr gmr released this 31 Mar 01:17
· 47 commits to main since this release
db0bf9a

Breaking Changes

  • Entry.desc is now ObjectType instead of String — The desc field on Entry is now a strongly-typed ObjectType enum with 50+ variants covering all known pg_dump object types, plus Other(String) for forward compatibility.
  • Dump::add_entry() takes ObjectType instead of &str — Pass ObjectType::Table, ObjectType::TableData, etc. instead of string literals.
  • Dump::lookup_entry() takes &ObjectType instead of &str for the desc parameter.
  • Error::EntityNotFound.desc is now ObjectType instead of String.

New Features

  • Weighted topological sort — TOC entries are automatically sorted on Dump::save() using the same two-phase algorithm as pg_dump (pg_dump_sort.c): cosmetic sort by type priority, namespace, and name, followed by Kahn's algorithm with a max-heap to satisfy dependencies while preserving order. Also available via Dump::sort_entries().
  • ObjectType enum — Type-safe representation of all pg_dump object types with section(), priority(), as_str(), Display, Ord, and From<&str>/From<String> conversions. Unknown types preserved via Other(String) for round-trip fidelity.
  • Dump::get_entry_mut() — Mutable access to entries by dump_id.

Improvements

  • Format readers now return an error on missing/NULL descriptors instead of silently defaulting to Other("").
  • ObjectType::as_str() returns &'static str for known variants, eliminating heap allocations in sort comparisons and format writers.
  • constants.rs reduced to just the MAGIC constant — all object type strings and section mapping are now methods on ObjectType.