use crate::utils::aliases::ARlockmap;
use std::collections::HashMap;
use std::sync::{Arc, RwLock};
use tower_http::services::ServeDir;

/// Crée un nouvel `Arc` autour d'une valeur.
#[doc = include_str!("../../../doc-tests/aliases/aliases_new.md")]
pub fn new<T>(value: T) -> Arc<T> {
    Arc::new(value)
}

/// Crée un nouveau registre partagé (ARlockmap).
#[doc = include_str!("../../../doc-tests/aliases/aliases_new_registry.md")]
pub fn new_registry() -> ARlockmap {
    Arc::new(RwLock::new(HashMap::new()))
}

/// Crée un service ServeDir pour servir des fichiers statiques.
///
/// # Exemple
///
/// ```rust,ignore
/// use tower_http::services::ServeDir;
/// let serve = ServeDir::new("./static");
/// ```
pub fn new_serve<P: AsRef<std::path::Path>>(path: P) -> ServeDir {
    ServeDir::new(path)
}
