Skip to content

Commit

Permalink
Merge pull request #1821 from CosmWasm/1809-document-order
Browse files Browse the repository at this point in the history
Document order of Coins::{to_vec, into_vec}
  • Loading branch information
chipshort authored Aug 17, 2023
2 parents 349f45a + 98d2459 commit 019be45
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/std/src/coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,18 @@ impl fmt::Display for Coins {
}

impl Coins {
/// Conversion to Vec<Coin>, while NOT consuming the original object
/// Conversion to Vec<Coin>, while NOT consuming the original object.
///
/// This produces a vector of coins that is sorted alphabetically by denom with
/// no duplicate denoms.
pub fn to_vec(&self) -> Vec<Coin> {
self.0.values().cloned().collect()
}

/// Conversion to Vec<Coin>, consuming the original object
/// Conversion to Vec<Coin>, consuming the original object.
///
/// This produces a vector of coins that is sorted alphabetically by denom with
/// no duplicate denoms.
pub fn into_vec(self) -> Vec<Coin> {
self.0.into_values().collect()
}
Expand Down

0 comments on commit 019be45

Please sign in to comment.