#sorting #f64 #f32 #ord #order #wrapper #no-std

no-std ordered-float

Wrappers for total ordering on floats

41 stable releases (4 major)

4.6.0 Dec 19, 2024
4.5.0 Nov 3, 2024
4.4.0 Oct 16, 2024
4.2.2 Jul 29, 2024
0.0.1 Nov 11, 2014

#7 in Rust patterns

Download history 1584533/week @ 2024-09-20 1527155/week @ 2024-09-27 1537341/week @ 2024-10-04 1459663/week @ 2024-10-11 1495911/week @ 2024-10-18 1532588/week @ 2024-10-25 1383790/week @ 2024-11-01 1498940/week @ 2024-11-08 1518354/week @ 2024-11-15 1216313/week @ 2024-11-22 1155697/week @ 2024-11-29 1472834/week @ 2024-12-06 1390198/week @ 2024-12-13 654440/week @ 2024-12-20 582808/week @ 2024-12-27 1026924/week @ 2025-01-03

3,940,980 downloads per month
Used in 3,828 crates (598 directly)

MIT license

96KB
2.5K SLoC

ordered-float

Provides several wrapper types for Ord and Eq implementations on f64 and friends.

no_std

To use ordered_float without requiring the Rust standard library, disable the default std feature:

[dependencies]
ordered-float = { version = "4.0", default-features = false }

If you still want to have access to the Pow and Float traits, enable the libm feature.

Optional features

The following optional features can be enabled in Cargo.toml:

  • libm: When not using the std feature, enable the libm feature of num-traits to still access the Pow and Float traits.
  • arbitrary: Implements the arbitrary::Arbitrary trait.
  • borsh: Adds implementations for traits provided by the borsh crate.
  • bytemuck: Adds implementations for traits provided by the bytemuck crate.
  • derive-visitor: Adds implementations for traits provided by the derive-visitor crate.
  • num-cmp: Implements the num_cmp::NumCmp trait.
  • proptest: Implements the proptest::Arbitrary trait.
  • rand: Adds implementations for various distribution types provided by the rand crate.
  • rkyv_16: Implements rkyv's Archive, Serialize and Deserialize traits with size_16.
  • rkyv_32: Implements rkyv's Archive, Serialize and Deserialize traits with size_32.
  • rkyv_64: Implements rkyv's Archive, Serialize and Deserialize traits with size_64.
  • rkyv_ck: Implements the bytecheck::CheckBytes trait.
  • schemars: Implements the schemars::JsonSchema trait.
  • serde: Implements the serde::Serialize and serde::Deserialize traits.
  • speedy: Implements speedy's Readable and Writable traits.

License

MIT

Dependencies

~0.1–1.6MB
~30K SLoC