init: archlens — architecture diagram generator
Some checks failed
CI / Check / Test (push) Failing after 1m24s
Some checks failed
CI / Check / Test (push) Failing after 1m24s
Hex arch + DDD, tree-sitter parsing, Mermaid/ASCII output. Supports Rust + Python. 92 tests. CI, diff, --check for staleness detection.
This commit is contained in:
18
crates/domain/src/value_objects/source/file_path.rs
Normal file
18
crates/domain/src/value_objects/source/file_path.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use crate::DomainError;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct FilePath(String);
|
||||
|
||||
impl FilePath {
|
||||
pub fn new(value: &str) -> Result<Self, DomainError> {
|
||||
let trimmed = value.trim();
|
||||
if trimmed.is_empty() {
|
||||
return Err(DomainError::EmptyValue("FilePath"));
|
||||
}
|
||||
Ok(Self(trimmed.to_string()))
|
||||
}
|
||||
|
||||
pub fn as_str(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
16
crates/domain/src/value_objects/source/language.rs
Normal file
16
crates/domain/src/value_objects/source/language.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum Language {
|
||||
Rust,
|
||||
CSharp,
|
||||
Python,
|
||||
}
|
||||
|
||||
impl Language {
|
||||
pub fn name(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Rust => "Rust",
|
||||
Self::CSharp => "CSharp",
|
||||
Self::Python => "Python",
|
||||
}
|
||||
}
|
||||
}
|
||||
9
crates/domain/src/value_objects/source/mod.rs
Normal file
9
crates/domain/src/value_objects/source/mod.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
mod file_path;
|
||||
mod language;
|
||||
mod module_name;
|
||||
mod source_file;
|
||||
|
||||
pub use file_path::FilePath;
|
||||
pub use language::Language;
|
||||
pub use module_name::ModuleName;
|
||||
pub use source_file::SourceFile;
|
||||
18
crates/domain/src/value_objects/source/module_name.rs
Normal file
18
crates/domain/src/value_objects/source/module_name.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use crate::DomainError;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct ModuleName(String);
|
||||
|
||||
impl ModuleName {
|
||||
pub fn new(value: &str) -> Result<Self, DomainError> {
|
||||
let trimmed = value.trim();
|
||||
if trimmed.is_empty() {
|
||||
return Err(DomainError::EmptyValue("ModuleName"));
|
||||
}
|
||||
Ok(Self(trimmed.to_string()))
|
||||
}
|
||||
|
||||
pub fn as_str(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
21
crates/domain/src/value_objects/source/source_file.rs
Normal file
21
crates/domain/src/value_objects/source/source_file.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use crate::{FilePath, Language};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SourceFile {
|
||||
path: FilePath,
|
||||
language: Language,
|
||||
}
|
||||
|
||||
impl SourceFile {
|
||||
pub fn new(path: FilePath, language: Language) -> Self {
|
||||
Self { path, language }
|
||||
}
|
||||
|
||||
pub fn path(&self) -> &FilePath {
|
||||
&self.path
|
||||
}
|
||||
|
||||
pub fn language(&self) -> Language {
|
||||
self.language
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user