style: cargo fmt --all

This commit is contained in:
2026-05-31 05:31:42 +02:00
parent 4b31a0f74b
commit c2ebca0da0
138 changed files with 2422 additions and 1164 deletions

View File

@@ -1,6 +1,6 @@
use async_trait::async_trait;
use crate::common::errors::DomainError;
use crate::common::events::DomainEvent;
use async_trait::async_trait;
#[async_trait]
pub trait EventPublisher: Send + Sync {

View File

@@ -7,9 +7,10 @@ impl Checksum {
pub fn new(hex: impl Into<String>) -> Result<Self, DomainError> {
let hex = hex.into().to_lowercase();
if hex.len() != 64 {
return Err(DomainError::Validation(
format!("Checksum must be 64 hex characters, got {}", hex.len()),
));
return Err(DomainError::Validation(format!(
"Checksum must be 64 hex characters, got {}",
hex.len()
)));
}
if !hex.chars().all(|c| c.is_ascii_hexdigit()) {
return Err(DomainError::Validation(
@@ -19,7 +20,9 @@ impl Checksum {
Ok(Self(hex))
}
pub fn as_str(&self) -> &str { &self.0 }
pub fn as_str(&self) -> &str {
&self.0
}
}
impl std::fmt::Display for Checksum {

View File

@@ -1,12 +1,20 @@
use chrono::{DateTime, Utc};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize)]
#[derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, serde::Serialize, serde::Deserialize,
)]
pub struct DateTimeStamp(DateTime<Utc>);
impl DateTimeStamp {
pub fn now() -> Self { Self(Utc::now()) }
pub fn from_datetime(dt: DateTime<Utc>) -> Self { Self(dt) }
pub fn as_datetime(&self) -> &DateTime<Utc> { &self.0 }
pub fn now() -> Self {
Self(Utc::now())
}
pub fn from_datetime(dt: DateTime<Utc>) -> Self {
Self(dt)
}
pub fn as_datetime(&self) -> &DateTime<Utc> {
&self.0
}
}
impl std::fmt::Display for DateTimeStamp {
@@ -16,5 +24,7 @@ impl std::fmt::Display for DateTimeStamp {
}
impl From<DateTime<Utc>> for DateTimeStamp {
fn from(dt: DateTime<Utc>) -> Self { Self(dt) }
fn from(dt: DateTime<Utc>) -> Self {
Self(dt)
}
}

View File

@@ -12,7 +12,9 @@ impl Email {
Ok(Self(value))
}
pub fn as_str(&self) -> &str { &self.0 }
pub fn as_str(&self) -> &str {
&self.0
}
}
impl std::fmt::Display for Email {

View File

@@ -33,7 +33,11 @@ impl FilterCriteria {
Self::Or(conditions)
}
pub fn condition(field: impl Into<String>, op: FilterOperator, value: serde_json::Value) -> Self {
pub fn condition(
field: impl Into<String>,
op: FilterOperator,
value: serde_json::Value,
) -> Self {
Self::Condition(FilterCondition {
field: field.into(),
op,

View File

@@ -9,6 +9,10 @@ impl std::fmt::Debug for PasswordHash {
}
impl PasswordHash {
pub fn from_hash(hash: String) -> Self { Self(hash) }
pub fn as_str(&self) -> &str { &self.0 }
pub fn from_hash(hash: String) -> Self {
Self(hash)
}
pub fn as_str(&self) -> &str {
&self.0
}
}

View File

@@ -14,7 +14,9 @@ pub enum MetadataValue {
pub struct StructuredData(HashMap<String, MetadataValue>);
impl StructuredData {
pub fn new() -> Self { Self(HashMap::new()) }
pub fn new() -> Self {
Self(HashMap::new())
}
pub fn insert(&mut self, key: impl Into<String>, value: MetadataValue) {
self.0.insert(key.into(), value);
@@ -35,8 +37,12 @@ impl StructuredData {
self.0.keys()
}
pub fn is_empty(&self) -> bool { self.0.is_empty() }
pub fn len(&self) -> usize { self.0.len() }
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
pub fn len(&self) -> usize {
self.0.len()
}
pub fn merge_from(&mut self, other: StructuredData) {
self.0.extend(other.0);
@@ -46,9 +52,13 @@ impl StructuredData {
self.0.remove(key)
}
pub fn inner(&self) -> &HashMap<String, MetadataValue> { &self.0 }
pub fn inner(&self) -> &HashMap<String, MetadataValue> {
&self.0
}
}
impl Default for StructuredData {
fn default() -> Self { Self::new() }
fn default() -> Self {
Self::new()
}
}

View File

@@ -4,13 +4,21 @@ use uuid::Uuid;
pub struct SystemId(Uuid);
impl SystemId {
pub fn new() -> Self { Self(Uuid::new_v4()) }
pub fn from_uuid(id: Uuid) -> Self { Self(id) }
pub fn as_uuid(&self) -> &Uuid { &self.0 }
pub fn new() -> Self {
Self(Uuid::new_v4())
}
pub fn from_uuid(id: Uuid) -> Self {
Self(id)
}
pub fn as_uuid(&self) -> &Uuid {
&self.0
}
}
impl Default for SystemId {
fn default() -> Self { Self::new() }
fn default() -> Self {
Self::new()
}
}
impl std::fmt::Display for SystemId {
@@ -20,5 +28,7 @@ impl std::fmt::Display for SystemId {
}
impl From<Uuid> for SystemId {
fn from(id: Uuid) -> Self { Self(id) }
fn from(id: Uuid) -> Self {
Self(id)
}
}