refactor: change function definitions to const for improved performance and clarity

This commit is contained in:
Tunglies
2025-11-06 10:47:25 +08:00
parent aaf3ebe547
commit 5a8e83cd49
14 changed files with 18 additions and 17 deletions

View File

@@ -611,6 +611,6 @@ impl PrfItem {
}
// 向前兼容,默认为订阅启用自动更新
fn default_allow_auto_update() -> Option<bool> {
const fn default_allow_auto_update() -> Option<bool> {
Some(true)
}

View File

@@ -102,12 +102,12 @@ impl IProfiles {
}
}
pub fn get_current(&self) -> Option<&String> {
pub const fn get_current(&self) -> Option<&String> {
self.current.as_ref()
}
/// get items ref
pub fn get_items(&self) -> Option<&Vec<PrfItem>> {
pub const fn get_items(&self) -> Option<&Vec<PrfItem>> {
self.items.as_ref()
}

View File

@@ -531,7 +531,7 @@ impl IVerge {
patch!(enable_external_controller);
}
pub fn get_singleton_port() -> u16 {
pub const fn get_singleton_port() -> u16 {
crate::constants::network::ports::SINGLETON_SERVER
}