style: apply cargo fmt to entire codebase

Standardize code formatting across all 173 Rust source files
using rustfmt. No functional changes - purely cosmetic.

This establishes a consistent code style baseline for the
project going forward.
This commit is contained in:
Dionisio
2026-02-14 01:29:34 +01:00
parent 67137a3ef2
commit 4c98c5a657
173 changed files with 23368 additions and 17590 deletions
+8 -8
View File
@@ -6,10 +6,10 @@ use thiserror::Error;
pub enum I18nError {
#[error("Translation key not found: {0}")]
KeyNotFound(String),
#[error("Invalid locale: {0}")]
InvalidLocale(String),
#[error("Error loading translations: {0}")]
LoadError(String),
}
@@ -38,7 +38,7 @@ impl Locale {
Locale::Portuguese => "pt",
}
}
/// Create from locale code string
pub fn from_str(code: &str) -> Option<Self> {
match code.to_lowercase().as_str() {
@@ -50,7 +50,7 @@ impl Locale {
_ => None,
}
}
/// Get default locale
pub fn default() -> Self {
Locale::English
@@ -62,13 +62,13 @@ impl Locale {
pub trait I18nService: Send + Sync + 'static {
/// Get a translation for a key and locale
async fn translate(&self, key: &str, locale: Locale) -> I18nResult<String>;
/// Load translations for a locale
async fn load_translations(&self, locale: Locale) -> I18nResult<()>;
/// Get available locales
async fn available_locales(&self) -> Vec<Locale>;
/// Check if a locale is supported
async fn is_supported(&self, locale: Locale) -> bool;
}
}
+1 -1
View File
@@ -2,4 +2,4 @@ pub mod i18n_service;
pub mod path_service;
// NOTE: auth_service has been moved to infrastructure/services/jwt_service.rs
// The functionality is now exposed through application/ports/auth_ports.rs (TokenServicePort)
// The functionality is now exposed through application/ports/auth_ports.rs (TokenServicePort)
+27 -21
View File
@@ -1,7 +1,7 @@
//! StoragePath - Domain Value Object for representing storage paths
//!
//!
//! This module contains only the StoragePath Value Object which is part of the pure domain.
//! PathService (which implements StoragePort and StorageMediator) was moved to
//! PathService (which implements StoragePort and StorageMediator) was moved to
//! infrastructure/services/path_service.rs because it has file system dependencies.
use std::path::PathBuf;
@@ -17,12 +17,14 @@ impl StoragePath {
pub fn new(segments: Vec<String>) -> Self {
Self { segments }
}
/// Creates an empty path (root)
pub fn root() -> Self {
Self { segments: Vec::new() }
Self {
segments: Vec::new(),
}
}
/// Creates a path from a string with segments separated by /
pub fn from_string(path: &str) -> Self {
let segments = path
@@ -32,7 +34,7 @@ impl StoragePath {
.collect();
Self { segments }
}
/// Creates a path from a PathBuf
pub fn from(path_buf: PathBuf) -> Self {
let segments = path_buf
@@ -44,34 +46,38 @@ impl StoragePath {
.collect();
Self { segments }
}
/// Appends a segment to the path
pub fn join(&self, segment: &str) -> Self {
let mut new_segments = self.segments.clone();
new_segments.push(segment.to_string());
Self { segments: new_segments }
Self {
segments: new_segments,
}
}
/// Gets the file name (last segment)
pub fn file_name(&self) -> Option<String> {
self.segments.last().cloned()
}
/// Gets the parent directory path
pub fn parent(&self) -> Option<Self> {
if self.segments.is_empty() {
None
} else {
let parent_segments = self.segments[..self.segments.len() - 1].to_vec();
Some(Self { segments: parent_segments })
Some(Self {
segments: parent_segments,
})
}
}
/// Checks if the path is empty (is the root)
pub fn is_empty(&self) -> bool {
self.segments.is_empty()
}
/// Converts the path to a string with format "/segment1/segment2/..."
pub fn to_string(&self) -> String {
if self.segments.is_empty() {
@@ -80,7 +86,7 @@ impl StoragePath {
format!("/{}", self.segments.join("/"))
}
}
/// Returns the path representation as a string
pub fn as_str(&self) -> &str {
// Note: The implementation should really store the string,
@@ -88,7 +94,7 @@ impl StoragePath {
// This is only used for the get_folder_path_str implementation
"/"
}
/// Gets the path segments
pub fn segments(&self) -> &[String] {
&self.segments
@@ -98,38 +104,38 @@ impl StoragePath {
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_storage_path_from_string() {
let path = StoragePath::from_string("folder/subfolder/file.txt");
assert_eq!(path.segments(), &["folder", "subfolder", "file.txt"]);
assert_eq!(path.to_string(), "/folder/subfolder/file.txt");
}
#[test]
fn test_storage_path_join() {
let path = StoragePath::from_string("folder");
let joined = path.join("file.txt");
assert_eq!(joined.to_string(), "/folder/file.txt");
}
#[test]
fn test_storage_path_parent() {
let path = StoragePath::from_string("folder/file.txt");
let parent = path.parent().unwrap();
assert_eq!(parent.to_string(), "/folder");
}
#[test]
fn test_storage_path_root() {
let root = StoragePath::root();
assert!(root.is_empty());
assert_eq!(root.to_string(), "/");
}
#[test]
fn test_storage_path_file_name() {
let path = StoragePath::from_string("folder/file.txt");
assert_eq!(path.file_name(), Some("file.txt".to_string()));
}
}
}