私は遊んでいるこのおもちゃの構造を持っています:
pub struct Community {
pub community_contents: RwLock<CommunityContents>,
}
pub struct CommunityContents {
pub friends: RefCell<HashMap<FriendID, FriendData>>,
pub index: RefCell<HashMap<u64, BTreeMap<FriendID, FriendData>>>,
pub authenticated: bool,
pub age: u64,
pub height: u64,
}
私の理論は、 ofのArc
周りに複数のライターを配置し、これらのライターがviaのフィールドとフィールドを個別に/同時に変更できるようにすることでした。RwLock
Community
RwLock
friends
index
CommunityContents
Rc<RefCell
これは可能ですか?RwLock
一度に複数のライターを許可しないでください。その場合、を削除してRefCells
構造全体を単純化する必要がありますか?