Skip to content

Commit 9fa5884

Browse files
committed
Implement PartialOrd and Ord for Binary
1 parent f0c3d6b commit 9fa5884

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ and this project adheres to
6363
- cosmwasm-std: Add `Decimal::inv` that returns `1/d` for decimal `d`.
6464
- cosmwasm-vm: Add `Cache::metrics` to expose internal data for monitoring
6565
purposes ([#763]).
66+
- cosmwasm-std: Implement `PartialOrd` and `Ord` for `Binary` using the same
67+
lexicographical ordering as implemented by `Vec<u8>`.
6668

6769
[#692]: https://github.com/CosmWasm/cosmwasm/issues/692
6870
[#706]: https://github.com/CosmWasm/cosmwasm/pull/706

packages/std/src/binary.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::errors::{StdError, StdResult};
1010
/// with serde. It also adds some helper methods to help encode inline.
1111
///
1212
/// This is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>
13-
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash, JsonSchema)]
13+
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, JsonSchema)]
1414
pub struct Binary(#[schemars(with = "String")] pub Vec<u8>);
1515

1616
impl Binary {

0 commit comments

Comments
 (0)