Last active
September 5, 2023 07:14
-
-
Save webmaster128/57f32f48a98f999318704cd6044dddc9 to your computer and use it in GitHub Desktop.
Revisions
-
webmaster128 revised this gist
Sep 5, 2023 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,10 +13,11 @@ fn can_loop_through_coins() -> StdResult<()> { println!("Element: {owned_coin}"); } Ok(()) } // Prints // Element: 65uatom // Element: 130uwasm // Element: 65uatom // Element: 130uwasm -
webmaster128 created this gist
Sep 5, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #[test] fn can_loop_through_coins() -> StdResult<()> { let mut coins = Coins::default(); coins.add(Coin::new(123, "uwasm"))?; coins.add(Coin::new(7, "uwasm"))?; coins.add(Coin::new(65, "uatom"))?; for borrowed_coin in coins.iter() { println!("Element: {borrowed_coin}"); } for owned_coin in coins { println!("Element: {owned_coin}"); } // Element: 65uatom // Element: 130uwasm // Element: 65uatom // Element: 130uwasm Ok(()) }