use binary heap with a type that doesn't implement Ord?

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • datastructu-rs

    A small implementation of a binary heap, based on an array (or more specifically a Vec) in Rust.

    Like u/svetlin_zarev said, you could use the newtype pattern. Your "priority value" obviously has to implement Ord, because you somehow need to be able to order it. I recently implemented a binary heap myself, if you look of one of my examples I provide I exactly do that. I have struct, that's essentially a touple of priority and your non Ord type. I then proceed to implement Ord (and the neccessary other traits) for this struct by using the Ord implementation of the priority value

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts