rename method

This commit is contained in:
yggverse 2026-03-28 04:56:46 +02:00
parent 7a440231a0
commit e48bfff21d
3 changed files with 5 additions and 5 deletions

View file

@ -34,7 +34,7 @@ async fn api_list_enable(
rules: &State<Arc<RwLock<Rules>>>, rules: &State<Arc<RwLock<Rules>>>,
) -> Result<Json<Option<bool>>, Status> { ) -> Result<Json<Option<bool>>, Status> {
Ok(Json( Ok(Json(
rules.write().await.set_status(alias, true).map(|old| !old), rules.write().await.set_enabled(alias, true).map(|old| !old),
)) ))
} }
@ -43,7 +43,7 @@ async fn api_list_disable(
alias: &str, alias: &str,
rules: &State<Arc<RwLock<Rules>>>, rules: &State<Arc<RwLock<Rules>>>,
) -> Result<Json<Option<bool>>, Status> { ) -> Result<Json<Option<bool>>, Status> {
Ok(Json(rules.write().await.set_status(alias, false))) Ok(Json(rules.write().await.set_enabled(alias, false)))
} }
#[rocket::launch] #[rocket::launch]

View file

@ -17,10 +17,10 @@ impl Rules {
.is_none()) .is_none())
} }
/// Change rule set status by list ID /// Change rule set status by list ID
pub fn set_status(&mut self, list_alias: &str, status: bool) -> Option<bool> { pub fn set_enabled(&mut self, list_alias: &str, status: bool) -> Option<bool> {
self.0 self.0
.get_mut(list_alias) .get_mut(list_alias)
.map(|list| list.set_status(status)) .map(|list| list.set_enabled(status))
} }
/// Check if rule is exist in the index /// Check if rule is exist in the index
pub fn any(&self, value: &str) -> bool { pub fn any(&self, value: &str) -> bool {

View file

@ -34,7 +34,7 @@ impl List {
}) })
} }
/// Change rule set status by list ID /// Change rule set status by list ID
pub fn set_status(&mut self, is_enabled: bool) -> bool { pub fn set_enabled(&mut self, is_enabled: bool) -> bool {
let was_enabled = self.is_enabled; let was_enabled = self.is_enabled;
self.is_enabled = is_enabled; self.is_enabled = is_enabled;
was_enabled was_enabled