self.id fix in mutable context example

This commit is contained in:
jsus 2021-09-19 00:39:51 +03:00 committed by Christian Legnitto
parent 8d27055561
commit 9bd9727cb2

View file

@ -123,7 +123,7 @@ impl User {
// If context is immutable use .read() on RwLock // If context is immutable use .read() on RwLock
let mut context = context.write().await; let mut context = context.write().await;
// Preform a mutable operation // Preform a mutable operation
context.requested_count.entry(0).and_modify(|e| { *e += 1 }).or_insert(1) context.requested_count.entry(self.id).and_modify(|e| { *e += 1 }).or_insert(1)
} }
fn name(&self) -> &str { fn name(&self) -> &str {