diff --git a/rustbook-uz/src/ch15-04-rc.md b/rustbook-uz/src/ch15-04-rc.md index 28268b5..00f6d56 100644 --- a/rustbook-uz/src/ch15-04-rc.md +++ b/rustbook-uz/src/ch15-04-rc.md @@ -83,18 +83,8 @@ Ushbu kod quyidagini print qiladi: `a`da `Rc`ning referens soni 1 ekanligini ko'rishimiz mumkin; keyinchalik har safar biz `clone` ni chaqirganimizda, son 1ga ortib boraveradi. `c` o'z scope(doirasi)dan chiqib ketganida,referens soni 1ga kamayadi. `Rc::clone` funksiyasi yordamida referens sonini ortirish uchun chaqirganimizdek referens soni kamaytirish uchun hech qanday funksiyasini chaqirishimiz kerak bo'lmaydi, chunki `Drop` traitining implementatsiyasi `Rc` qiymati o'z scope(doirasi)dan chiqqanda avtomatik ravishda referens sonini kamaytiradi. -`main` oxirida `b` va keyin `a`larning scope(doirasidan) chiqib, son/hisob 0ga tenglashib, `Rc` to'liq tozalanganligini biz ushbu misolda ko'ra olmaymiz. Using `Rc` allows a single value to have multiple owners, and the count ensures that the value remains valid as long as any of the owners -still exist. +`main` oxirida `b` va keyin `a`larning scope(doirasidan) chiqib, son/hisob 0ga tenglashib, `Rc` to'liq tozalanganligini biz ushbu misolda ko'ra olmaymiz. `Rc`ni ishlatish yordamida bitta qiymat ko'p egalarga ega bo'lishi mumkin, hamda son/hisob qiymat egalaridan biri bor bo'lgunga qadar yaroqliligini tekshirib turadi. - - -Via immutable references, `Rc` allows you to share data between multiple -parts of your program for reading only. If `Rc` allowed you to have multiple -mutable references too, you might violate one of the borrowing rules discussed -in Chapter 4: multiple mutable borrows to the same place can cause data races -and inconsistencies. But being able to mutate data is very useful! In the next -section, we’ll discuss the interior mutability pattern and the `RefCell` -type that you can use in conjunction with an `Rc` to work with this -immutability restriction. + O'zgarmas o'zgaruvchilar yordamida, `Rc` o'qish uchun ma'lumotlarni dasturning ko'p joylari orasida ulashish imkonini beradi. Agar `Rc` ko'p o'zgaruvchan referenslarga ega bo'lish imkonini bergan bo'lsa, siz 4-Bo'limda ko'rsatilganidek borrowing qoidalarini birini buzishingiz mumkin: ko'p o'zgaruchilar bir xil joyga borrow qilib data race va nomuvofiqliklarga sabab bo'lishi mumkin. Lekin ma'lumotni o'zrgatira olish foydalidir! keyingi bo'limda, biz ichki o'zgaruvchanlik shakli(pattern) va `RefCell` turi bilan `Rc` yordamida o'zgarmaslik cheklovi bilan ishlash ko'rib chiqamiz. [preventing-ref-cycles]: ch15-06-reference-cycles.html#preventing-reference-cycles-turning-an-rct-into-a-weakt