Garrett :spinning_pinwheel: on Nostr: m.values().filter(|p| **p == v).count() This feels…wrong. values() returns an ...
m.values().filter(|p| **p == v).count()
This feels…wrong.
values() returns an iterator of references. Why does filter() reference each reference? Is the ** conventional is this kind of situation, or is there a better way to do this?
#rust
Published at
2024-03-10 17:11:17Event JSON
{
"id": "cac4246a2c42c30f478e5ad82468b046ce110c99b2ed482b0ca0bd2499da9545",
"pubkey": "bba22c219cde1b4bc9150c734945a8dcda7df0557df24a7fe18dc212ec8f7aea",
"created_at": 1710090677,
"kind": 1,
"tags": [
[
"t",
"rust"
],
[
"proxy",
"https://social.lol/users/heygarrett/statuses/112072502609821909",
"activitypub"
]
],
"content": "m.values().filter(|p| **p == v).count()\n\nThis feels…wrong.\nvalues() returns an iterator of references. Why does filter() reference each reference? Is the ** conventional is this kind of situation, or is there a better way to do this?\n\n#rust",
"sig": "33305b68221771102f33a934404f625d60455d34197aee3f18c273299cc5aaec7fd1888cc144794826ed7997bd61730b060314a7240db0159d3ec26235af6fbd"
}