From 718176edbdc0a277abb7ec4f5bb4ad7de713f853 Mon Sep 17 00:00:00 2001 From: davidemazzocchi Date: Thu, 9 Oct 2025 15:41:39 +0200 Subject: [PATCH] doc: clean code for documentation output --- 01.workspace/heave/src/lib.rs | 8 ++++---- 01.workspace/heave/src/str/attribute.rs | 2 +- 01.workspace/heave/src/str/catalog.rs | 2 +- 01.workspace/heave/src/str/entity.rs | 2 +- 01.workspace/heave/src/str/entity_state.rs | 4 ++-- 01.workspace/heave/src/str/failed_to.rs | 4 ++-- 01.workspace/heave/src/str/sqlite_failed_to.rs | 2 +- 01.workspace/heave/src/str/value.rs | 4 ++-- 01.workspace/heave/src/trt/eav.rs | 5 ++--- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/01.workspace/heave/src/lib.rs b/01.workspace/heave/src/lib.rs index b73d8c0..d79dbd7 100644 --- a/01.workspace/heave/src/lib.rs +++ b/01.workspace/heave/src/lib.rs @@ -10,13 +10,13 @@ mod tst; pub(crate) use crate::str::attribute::O as Attribute; pub use crate::str::catalog::O as Catalog; pub use crate::str::entity::O as Entity; -pub use crate::str::entity_state::E as EntityState; -pub use crate::str::failed_to::E as FailedTo; -pub(crate) use crate::str::value::E as Value; +pub use crate::str::entity_state::EntityState; +pub use crate::str::failed_to::FailedTo; +pub(crate) use crate::str::value::Value; pub use crate::trt::eav::T as EAV; mod sqlite { - pub use crate::str::sqlite_failed_to::E as FailedTo; + pub use crate::str::sqlite_failed_to::FailedTo; pub mod init { pub use crate::fun::sqlite_init_db::run as db; } diff --git a/01.workspace/heave/src/str/attribute.rs b/01.workspace/heave/src/str/attribute.rs index e9aebc1..797a278 100644 --- a/01.workspace/heave/src/str/attribute.rs +++ b/01.workspace/heave/src/str/attribute.rs @@ -6,7 +6,7 @@ pub struct O { pub value: Value, } -impl O { +impl Attribute { pub fn new(id: &str, value: impl Into) -> Self { Self { id: String::from(id), diff --git a/01.workspace/heave/src/str/catalog.rs b/01.workspace/heave/src/str/catalog.rs index 34dc370..2029ab1 100644 --- a/01.workspace/heave/src/str/catalog.rs +++ b/01.workspace/heave/src/str/catalog.rs @@ -9,7 +9,7 @@ pub struct O { path: String, pub(crate) items: std::collections::HashMap, } -impl O { +impl Catalog { /// Creates a new `Catalog` instance. /// /// # Arguments diff --git a/01.workspace/heave/src/str/entity.rs b/01.workspace/heave/src/str/entity.rs index 1d07d04..07577a9 100644 --- a/01.workspace/heave/src/str/entity.rs +++ b/01.workspace/heave/src/str/entity.rs @@ -10,7 +10,7 @@ pub struct O { pub attributes: std::collections::HashMap, } -impl O { +impl Entity { /// Creates a new `Entity` instance for a given type `T` that implements `EAV`. /// /// # Returns diff --git a/01.workspace/heave/src/str/entity_state.rs b/01.workspace/heave/src/str/entity_state.rs index dfa168d..0270a34 100644 --- a/01.workspace/heave/src/str/entity_state.rs +++ b/01.workspace/heave/src/str/entity_state.rs @@ -1,6 +1,6 @@ /// Represents the state of an entity within the catalog. #[derive(Debug, Default, PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Hash)] -pub enum E { +pub enum EntityState { /// The entity is newly created and has not been persisted. #[default] New, @@ -10,4 +10,4 @@ pub enum E { Loaded, /// The entity is marked for deletion. ToDelete, -} \ No newline at end of file +} diff --git a/01.workspace/heave/src/str/failed_to.rs b/01.workspace/heave/src/str/failed_to.rs index c476d36..4493b36 100644 --- a/01.workspace/heave/src/str/failed_to.rs +++ b/01.workspace/heave/src/str/failed_to.rs @@ -2,7 +2,7 @@ use crate::*; /// Represents the possible failures that can occur in the library. #[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Hash)] -pub enum E { +pub enum FailedTo { /// Failed to initialize the database. InitDatabase, /// Failed to load data from the database. @@ -17,7 +17,7 @@ pub enum E { SQLite(sqlite::FailedTo), } -impl From for E { +impl From for FailedTo { fn from(value: sqlite::FailedTo) -> Self { Self::SQLite(value) } diff --git a/01.workspace/heave/src/str/sqlite_failed_to.rs b/01.workspace/heave/src/str/sqlite_failed_to.rs index e760b44..e560d44 100644 --- a/01.workspace/heave/src/str/sqlite_failed_to.rs +++ b/01.workspace/heave/src/str/sqlite_failed_to.rs @@ -1,5 +1,5 @@ #[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone, Copy, Hash)] -pub enum E { +pub enum FailedTo { BeginTransaction, CommitTransaction, ExecuteBatch, diff --git a/01.workspace/heave/src/str/value.rs b/01.workspace/heave/src/str/value.rs index c6a9071..c30f7c9 100644 --- a/01.workspace/heave/src/str/value.rs +++ b/01.workspace/heave/src/str/value.rs @@ -1,7 +1,7 @@ use crate::*; #[derive(Debug, PartialEq, PartialOrd, Clone)] -pub enum E { +pub enum Value { Bool(bool), Real(f64), SignedInt(i64), @@ -9,7 +9,7 @@ pub enum E { UnsignedInt(u64), } -impl std::fmt::Display for E { +impl std::fmt::Display for Value { fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { let string_value = match self { Value::Bool(value) => match value { diff --git a/01.workspace/heave/src/trt/eav.rs b/01.workspace/heave/src/trt/eav.rs index bff485e..9a00be8 100644 --- a/01.workspace/heave/src/trt/eav.rs +++ b/01.workspace/heave/src/trt/eav.rs @@ -4,8 +4,7 @@ use crate::*; /// /// This trait provides the necessary conversions to and from the generic `Entity` /// representation, and it requires the type to define its own class name. -pub trait T -where +pub trait T where Self: From, Self: Into, { @@ -13,4 +12,4 @@ where /// /// This is used to distinguish between different types of entities in the database. fn class() -> &'static str; -} \ No newline at end of file +}