Refactor for structured insertions

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-10-07 17:54:27 +00:00 committed by strawberry
parent 8258d16a94
commit 2ed0c267eb
31 changed files with 364 additions and 621 deletions

View file

@ -64,9 +64,9 @@ pub fn iter_ids(&self) -> impl Stream<Item = &RoomId> + Send + '_ { self.db.room
#[inline]
pub fn disable_room(&self, room_id: &RoomId, disabled: bool) {
if disabled {
self.db.disabledroomids.insert(room_id.as_bytes(), &[]);
self.db.disabledroomids.insert(room_id, []);
} else {
self.db.disabledroomids.remove(room_id.as_bytes());
self.db.disabledroomids.remove(room_id);
}
}
@ -74,9 +74,9 @@ pub fn disable_room(&self, room_id: &RoomId, disabled: bool) {
#[inline]
pub fn ban_room(&self, room_id: &RoomId, banned: bool) {
if banned {
self.db.bannedroomids.insert(room_id.as_bytes(), &[]);
self.db.bannedroomids.insert(room_id, []);
} else {
self.db.bannedroomids.remove(room_id.as_bytes());
self.db.bannedroomids.remove(room_id);
}
}