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
Unverified
parent aaf3ebe547
commit 5a8e83cd49
14 changed files with 18 additions and 17 deletions

View File

@@ -506,7 +506,7 @@ pub fn init_scheme() -> Result<()> {
Ok(())
}
#[cfg(target_os = "macos")]
pub fn init_scheme() -> Result<()> {
pub const fn init_scheme() -> Result<()> {
Ok(())
}

View File

@@ -26,7 +26,7 @@ pub struct HttpResponse {
}
impl HttpResponse {
pub fn new(status: StatusCode, headers: HeaderMap, body: String) -> Self {
pub const fn new(status: StatusCode, headers: HeaderMap, body: String) -> Self {
Self {
status,
headers,
@@ -34,11 +34,11 @@ impl HttpResponse {
}
}
pub fn status(&self) -> StatusCode {
pub const fn status(&self) -> StatusCode {
self.status
}
pub fn headers(&self) -> &HeaderMap {
pub const fn headers(&self) -> &HeaderMap {
&self.headers
}