From 4013549a538087dd3cf21ee2a593b6c7781bce3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EF=A4=8C?= <75060126+0xf90c@users.noreply.github.com> Date: Thu, 16 Jan 2025 12:07:54 +0500 Subject: [PATCH] update --- rustbook-uz/src/ch15-05-interior-mutability.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/rustbook-uz/src/ch15-05-interior-mutability.md b/rustbook-uz/src/ch15-05-interior-mutability.md index 69b9fc1..72ba51d 100644 --- a/rustbook-uz/src/ch15-05-interior-mutability.md +++ b/rustbook-uz/src/ch15-05-interior-mutability.md @@ -161,14 +161,7 @@ Tasdiqlash uchun biz qilishimiz kerak bo'lgan oxirgi o'zgarish bu: ichki vektor #### Keeping Track of Borrows at Runtime with `RefCell` -When creating immutable and mutable references, we use the `&` and `&mut` -syntax, respectively. With `RefCell`, we use the `borrow` and `borrow_mut` -methods, which are part of the safe API that belongs to `RefCell`. The -`borrow` method returns the smart pointer type `Ref`, and `borrow_mut` -returns the smart pointer type `RefMut`. Both types implement `Deref`, so we -can treat them like regular references. - -O'zgarmas va o'zgaruvchan havolalarni yaratishda biz mos ravishda `&` va `&mut` sintaksisidan foydalanamiz. `RefCell` bilan biz `RefCell`ga tegishli xavfsiz API tarkibiga kiruvchi `borrow` va `borrow_mut` usullaridan foydalanamiz. “Borrow” usuli “Ref” aqlli ko‘rsatkich turini, “borrow_mut” esa “RefMut” aqlli ko‘rsatkich turini qaytaradi. Ikkala tur ham "Deref" ni amalga oshiradi, shuning uchun biz ularni oddiy havolalar kabi ko'rib chiqishimiz mumkin. +O'zgarmas va o'zgaruvchan referencelarni yaratishda biz mos ravishda `&` va `&mut` sintaksisidan foydalanamiz. `RefCell` bilan biz `RefCell`ga tegishli xavfsiz API tarkibiga kiruvchi `borrow` va `borrow_mut` usullaridan foydalanamiz. `borrow` metodi `Ref` smart pointer turini, `borrow_mut` esa `RefMut` smart pointer turini qaytaradi. Ikkala tur ham `Deref` ni implementatsiya qiladi, shuning uchun biz ularni/doimiy oddiy reference kabi ko'rib chiqishimiz mumkin. The `RefCell` keeps track of how many `Ref` and `RefMut` smart pointers are currently active. Every time we call `borrow`, the `RefCell`