Skip to content

Commit 9bd9727

Browse files
esseswannLegNeato
authored andcommitted
self.id fix in mutable context example
1 parent 8d27055 commit 9bd9727

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/book/content/types/objects/using_contexts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl User {
123123
// If context is immutable use .read() on RwLock
124124
let mut context = context.write().await;
125125
// Preform a mutable operation
126-
context.requested_count.entry(0).and_modify(|e| { *e += 1 }).or_insert(1)
126+
context.requested_count.entry(self.id).and_modify(|e| { *e += 1 }).or_insert(1)
127127
}
128128

129129
fn name(&self) -> &str {

0 commit comments

Comments
 (0)