Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/src/config/fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::*;
///
/// # Returns
///
/// - `Args`: Parsed arguments
/// - `Args` - Parsed arguments
pub fn parse_args() -> Args {
let raw_args: Vec<String> = args().collect();
let mut command: CommandType = CommandType::Help;
Expand Down
14 changes: 7 additions & 7 deletions cli/src/new/fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use super::*;
///
/// # Arguments
///
/// - `&str`: Project name to validate
/// - `&str` - Project name to validate
///
/// # Returns
///
/// - `Result<(), NewError>`: Ok if valid, error otherwise
/// - `Result<(), NewError>` - Ok if valid, error otherwise
fn validate_project_name(name: &str) -> Result<(), NewError> {
if name.is_empty() {
return Err(NewError::InvalidName(
Expand All @@ -32,7 +32,7 @@ fn validate_project_name(name: &str) -> Result<(), NewError> {
///
/// # Returns
///
/// - `Result<(), NewError>`: Ok if git is available, error otherwise
/// - `Result<(), NewError>` - Ok if git is available, error otherwise
async fn check_git_available() -> Result<(), NewError> {
let output: std::process::Output = Command::new("git")
.arg("--version")
Expand All @@ -52,11 +52,11 @@ async fn check_git_available() -> Result<(), NewError> {
///
/// # Arguments
///
/// - `&NewProjectConfig`: Project configuration containing template URL and project name
/// - `&NewProjectConfig` - Project configuration containing template URL and project name
///
/// # Returns
///
/// - `Result<(), NewError>`: Success or error
/// - `Result<(), NewError>` - Success or error
async fn git_clone(config: &NewProjectConfig) -> Result<(), NewError> {
let project_path: PathBuf = PathBuf::from(&config.project_name);
if project_path.exists() {
Expand All @@ -83,11 +83,11 @@ async fn git_clone(config: &NewProjectConfig) -> Result<(), NewError> {
///
/// # Arguments
///
/// - `&str`: Name of the project to create
/// - `&str` - Name of the project to create
///
/// # Returns
///
/// - `Result<(), NewError>`: Success or error
/// - `Result<(), NewError>` - Success or error
pub async fn execute_new(project_name: &str) -> Result<(), NewError> {
validate_project_name(project_name)?;
check_git_available().await?;
Expand Down
4 changes: 2 additions & 2 deletions cli/src/new/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ impl NewProjectConfig {
///
/// # Arguments
///
/// - `String`: Name of the project
/// - `String` - Name of the project
///
/// # Returns
///
/// - `Self`: Configuration instance
/// - `Self` - Configuration instance
pub fn new(project_name: String) -> Self {
Self {
project_name,
Expand Down
90 changes: 45 additions & 45 deletions cli/src/template/fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use super::*;
///
/// # Arguments
///
/// - `&TemplateType`: The template type
/// - `&TemplateType` - The template type
///
/// # Returns
///
/// - `String`: Directory name
/// - `String` - Directory name
fn get_directory_name(template_type: &TemplateType) -> String {
match template_type {
TemplateType::Controller => "controller".to_string(),
Expand All @@ -27,11 +27,11 @@ fn get_directory_name(template_type: &TemplateType) -> String {
///
/// # Arguments
///
/// - `&ModelSubType`: The model subtype
/// - `&ModelSubType` - The model subtype
///
/// # Returns
///
/// - `String`: Directory name
/// - `String` - Directory name
fn get_model_sub_type_name(sub_type: &ModelSubType) -> String {
match sub_type {
ModelSubType::Application => "application".to_string(),
Expand All @@ -44,11 +44,11 @@ fn get_model_sub_type_name(sub_type: &ModelSubType) -> String {
///
/// # Arguments
///
/// - `&Path`: Path to the directory
/// - `&Path` - Path to the directory
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn ensure_directory(path: &Path) -> Result<(), TemplateError> {
if !path.exists() {
create_dir_all(path).await?;
Expand All @@ -60,12 +60,12 @@ async fn ensure_directory(path: &Path) -> Result<(), TemplateError> {
///
/// # Arguments
///
/// - `&Path`: Path to mod.rs file
/// - `&[&str]`: List of modules to include
/// - `&Path` - Path to mod.rs file
/// - `&[&str]` - List of modules to include
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn write_mod_rs(path: &Path, modules: &[&str]) -> Result<(), TemplateError> {
let mut content: String = String::new();
for module in modules {
Expand Down Expand Up @@ -112,11 +112,11 @@ async fn write_mod_rs(path: &Path, modules: &[&str]) -> Result<(), TemplateError
///
/// # Arguments
///
/// - `&Path`: Path to mod.rs file
/// - `&Path` - Path to mod.rs file
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn write_empty_mod_rs(path: &Path) -> Result<(), TemplateError> {
write(path, "\n").await?;
Ok(())
Expand All @@ -126,12 +126,12 @@ async fn write_empty_mod_rs(path: &Path) -> Result<(), TemplateError> {
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_controller_template(
target_dir: &Path,
_component_name: &str,
Expand All @@ -152,12 +152,12 @@ async fn create_controller_template(
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_view_template(
target_dir: &Path,
_component_name: &str,
Expand All @@ -178,12 +178,12 @@ async fn create_view_template(
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_service_template(
target_dir: &Path,
_component_name: &str,
Expand All @@ -202,12 +202,12 @@ async fn create_service_template(
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_domain_template(
target_dir: &Path,
_component_name: &str,
Expand All @@ -226,12 +226,12 @@ async fn create_domain_template(
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_mapper_template(
target_dir: &Path,
_component_name: &str,
Expand Down Expand Up @@ -262,12 +262,12 @@ async fn create_mapper_template(
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_utils_template(
target_dir: &Path,
_component_name: &str,
Expand All @@ -284,12 +284,12 @@ async fn create_utils_template(
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_exception_template(
target_dir: &Path,
_component_name: &str,
Expand All @@ -304,12 +304,12 @@ async fn create_exception_template(
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_repository_template(
target_dir: &Path,
_component_name: &str,
Expand All @@ -328,13 +328,13 @@ async fn create_repository_template(
///
/// # Arguments
///
/// - `&Path`: Target directory path
/// - `&str`: Name of the component
/// - `&ModelSubType`: Model subtype
/// - `&Path` - Target directory path
/// - `&str` - Name of the component
/// - `&ModelSubType` - Model subtype
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
async fn create_model_template(
target_dir: &Path,
_component_name: &str,
Expand All @@ -354,13 +354,13 @@ async fn create_model_template(
///
/// # Arguments
///
/// - `&TemplateType`: Type of template component
/// - `&str`: Name of the component
/// - `model_sub_type`: Optional model subtype
/// - `&TemplateType` - Type of template component
/// - `&str` - Name of the component
/// - `model_sub_type` - Optional model subtype
///
/// # Returns
///
/// - `Result<(), TemplateError>`: Success or error
/// - `Result<(), TemplateError>` - Success or error
pub async fn execute_template(
template_type: TemplateType,
component_name: &str,
Expand Down Expand Up @@ -416,11 +416,11 @@ pub async fn execute_template(
///
/// # Arguments
///
/// - `&Path`: Path to format
/// - `&Path` - Path to format
///
/// # Returns
///
/// - `Result<(), io::Error>`: Success or error
/// - `Result<(), io::Error>` - Success or error
async fn format_generated_path(path: &Path) -> Result<(), io::Error> {
let mut cmd: Command = Command::new("cargo");
cmd.arg("fmt").arg("--").arg(path);
Expand Down
8 changes: 4 additions & 4 deletions cli/src/template/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ impl TemplateConfig {
///
/// # Arguments
///
/// - `TemplateType`: Type of template component
/// - `String`: Name of the component
/// - `Option<ModelSubType>`: Optional model subtype for model components
/// - `TemplateType` - Type of template component
/// - `String` - Name of the component
/// - `Option<ModelSubType>` - Optional model subtype for model components
///
/// # Returns
///
/// - `Self`: Configuration instance
/// - `Self` - Configuration instance
pub fn new(
template_type: TemplateType,
component_name: String,
Expand Down
4 changes: 2 additions & 2 deletions cli/src/watch/fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::*;
///
/// # Returns
///
/// - `Result<(), io::Error>`: Success or error
/// - `Result<(), io::Error>` - Success or error
async fn run_cargo_run() -> Result<(), io::Error> {
let output: std::process::Output = Command::new("cargo")
.arg("run")
Expand Down Expand Up @@ -45,7 +45,7 @@ async fn run_cargo_run() -> Result<(), io::Error> {
///
/// # Returns
///
/// - `Result<(), io::Error>`: Success or error
/// - `Result<(), io::Error>` - Success or error
pub async fn execute_watch() -> Result<(), io::Error> {
let src_path: PathBuf = PathBuf::from("src");
if !src_path.exists() {
Expand Down
22 changes: 21 additions & 1 deletion constant/src/common/const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub const DOUBLE_BR: &str = "\n\n";
/// A const byte slice representation of the string `DOUBLE_BR`.
pub const DOUBLE_BR_BYTES: &[u8] = DOUBLE_BR.as_bytes();

/// A colon followed by a space (`: `).
/// A colon followed by a space (` - `).
/// This constant is commonly used in formatted strings, such as
/// headers or key-value pairs, where a colon and a space are needed.
pub const COLON_SPACE: &str = ": ";
Expand Down Expand Up @@ -224,6 +224,26 @@ pub const ZERO_STR_U8: u8 = ZERO_STR_BYTES[0];
/// operations, such as reading from a network stream.
pub const DEFAULT_BUFFER_SIZE: usize = KB_4;

/// The initial capacity of the request-line buffer.
/// This constant defines the initial string capacity used when reading
/// the HTTP request line; the string grows automatically for longer lines.
pub const REQUEST_LINE_BUFFER_CAPACITY: usize = B_128;

/// The initial capacity of the header-line buffer.
/// This constant defines the initial string capacity used when reading
/// a single HTTP header line; the string grows automatically for longer lines.
pub const HEADER_LINE_BUFFER_CAPACITY: usize = B_256;

/// The maximum number of pooled read buffers retained per thread.
/// This constant caps the thread-local read-buffer pool size to bound
/// the memory retained for connection reuse.
pub const MAX_POOLED_READ_BUFFERS: usize = B_64;

/// The maximum byte size of a read buffer eligible for pooling.
/// This constant prevents oversized buffers from being retained in
/// the thread-local read-buffer pool.
pub const MAX_POOLED_READ_BUFFER_SIZE: usize = KB_64;

/// The default maximum path size.
/// This constant defines the maximum size of the path component
/// in an HTTP request to prevent excessive memory usage.
Expand Down
Loading
Loading