Remove redundant doc comments

This commit is contained in:
a2x
2024-03-02 01:02:58 +10:00
parent c731cab0a0
commit 127cd110bb
24 changed files with 103 additions and 969 deletions

View File

@@ -1,9 +1,7 @@
use super::FileBuilder;
use std::io::{Result, Write};
/// A structure representing a builder for C++ header files.
/// The builder implements the `FileBuilder` trait.
use super::FileBuilder;
#[derive(Clone, Debug, PartialEq)]
pub struct CppFileBuilder;

View File

@@ -1,9 +1,7 @@
use super::FileBuilder;
use std::io::{Result, Write};
/// A structure representing a builder for C# files.
/// The builder implements the `FileBuilder` trait.
use super::FileBuilder;
#[derive(Clone, Debug, PartialEq)]
pub struct CSharpFileBuilder;

View File

@@ -1,42 +1,10 @@
use std::io::{Result, Write};
/// A trait that defines the file builder operations.
pub trait FileBuilder {
/// Returns the extension of the file.
///
/// # Arguments
///
/// * `&mut self` - A mutable reference to the `FileBuilder` struct.
///
/// # Returns
///
/// * `&str` - A string slice containing the extension of the file.
fn extension(&mut self) -> &str;
/// Writes to the top level of the file. The output destination is `output`.
///
/// # Arguments
///
/// * `&mut self` - A mutable reference to the `FileBuilder` struct.
/// * `output` - An object implementing Write trait where the top level will be written.
///
/// # Returns
///
/// * `Result<()>` - A generic Result type indicating the operations outcome.
fn write_top_level(&mut self, output: &mut dyn Write) -> Result<()>;
/// Writes a namespace to the output.
///
/// # Arguments
///
/// * `&mut self` - A mutable reference to the `FileBuilder` struct.
/// * `output` - An object implementing Write trait where the namespace will be written.
/// * `name` - The name of the namespace.
/// * `comment` - An optional comment. If present, this comment will be included in the output.
///
/// # Returns
///
/// * `Result<()>` - A generic Result type indicating the operations outcome.
fn write_namespace(
&mut self,
output: &mut dyn Write,
@@ -44,20 +12,6 @@ pub trait FileBuilder {
comment: Option<&str>,
) -> Result<()>;
/// Writes a variable to the output.
///
/// # Arguments
///
/// * `&mut self` - A mutable reference to the `FileBuilder` struct.
/// * `output` - An object implementing Write trait where the variable will be written.
/// * `name` - The name of the variable.
/// * `value` - The value of the variable.
/// * `comment` - An optional comment. If present, this comment will be included in the output.
/// * `indentation` - An optional indentation value. If present, the variable will be written with the specified indentation.
///
/// # Returns
///
/// * `Result<()>` - A generic Result type indicating the operations outcome.
fn write_variable(
&mut self,
output: &mut dyn Write,
@@ -67,16 +21,5 @@ pub trait FileBuilder {
indentation: Option<usize>,
) -> Result<()>;
/// Writes a closure to the output.
///
/// # Arguments
///
/// * `&mut self` - A mutable reference to the `FileBuilder` struct.
/// * `output` - An object implementing Write trait where the closure will be written.
/// * `eof` - A boolean value, if true, indicates that this is the last element to write to the output.
///
/// # Returns
///
/// * `Result<()>` - A generic Result type indicating the operations outcome.
fn write_closure(&mut self, output: &mut dyn Write, eof: bool) -> Result<()>;
}

View File

@@ -1,27 +1,22 @@
use super::FileBuilder;
use serde::Serialize;
use std::collections::BTreeMap;
use std::io::{Result, Write};
/// Represents a JSON offset value with an optional comment.
use serde::Serialize;
use super::FileBuilder;
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
struct JsonOffsetValue {
value: usize,
comment: Option<String>,
}
/// Represents a JSON module, which contains data in the form of a `BTreeMap` of string keys and
/// `JsonOffsetValue` values, as well as an optional comment.
#[derive(Clone, Debug, Default, PartialEq, Serialize)]
struct JsonModule {
data: BTreeMap<String, JsonOffsetValue>,
comment: Option<String>,
}
/// A structure representing a builder for JSON files.
/// The builder implements the `FileBuilder` trait.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct JsonFileBuilder {
data: BTreeMap<String, JsonModule>,

View File

@@ -6,7 +6,7 @@ pub use python_file_builder::PythonFileBuilder;
pub use rust_file_builder::RustFileBuilder;
pub use yaml_file_builder::YamlFileBuilder;
pub use std::io::{Result, Write};
use std::io::{Result, Write};
pub mod cpp_file_builder;
pub mod csharp_file_builder;
@@ -16,26 +16,13 @@ pub mod python_file_builder;
pub mod rust_file_builder;
pub mod yaml_file_builder;
/// `FileBuilder` is an enum that defines different kinds of file builders.
/// Each variant corresponds to a builder for a particular type of file.
#[derive(Clone, Debug, PartialEq)]
pub enum FileBuilderEnum {
/// Represents a builder for C++ header files.
CppFileBuilder(CppFileBuilder),
/// Represents a builder for C# files.
CSharpFileBuilder(CSharpFileBuilder),
/// Represents a builder for JSON files.
JsonFileBuilder(JsonFileBuilder),
/// Represents a builder for Python files.
PythonFileBuilder(PythonFileBuilder),
/// Represents a builder for Rust files.
RustFileBuilder(RustFileBuilder),
/// Represents a builder for YAML files.
YamlFileBuilder(YamlFileBuilder),
}

View File

@@ -1,9 +1,7 @@
use super::FileBuilder;
use std::io::{Result, Write};
/// A structure representing a builder for Python files.
/// The builder implements the `FileBuilder` trait.
use super::FileBuilder;
#[derive(Clone, Debug, PartialEq)]
pub struct PythonFileBuilder;

View File

@@ -2,8 +2,6 @@ use super::FileBuilder;
use std::io::{Result, Write};
/// A structure representing a builder for Rust files.
/// The builder implements the `FileBuilder` trait.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct RustFileBuilder;

View File

@@ -1,9 +1,7 @@
use super::FileBuilder;
use std::io::{Result, Write};
/// A structure representing a builder for Yaml files.
/// The builder implements the `FileBuilder` trait.
use super::FileBuilder;
#[derive(Clone, Debug, Default, PartialEq)]
pub struct YamlFileBuilder;