Skip to content

Commit 100755f

Browse files
committed
Updated AGENTS.md
Signed-off-by: Marvin Hansen <[email protected]>
1 parent e7d6b05 commit 100755f

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

AGENTS.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,28 @@ src/errors/mod.rs # contains each error type in a separate file
7272
src/traits/mod.rs # contains each trait in a separate file
7373
src/type/mod.rs # contains each type in a separate file
7474

75-
As a rule, one type, one file.
75+
## One type, one Rust module.
7676

77-
Optional src folders
77+
For very small types (total implementation in less than 25 lines), the type is stored in file named as snail_case of the type name. For example:
78+
79+
src/types/small_type.rs
80+
81+
For more complex types, the type is stored a folder module for example,
82+
the type Uncertain is stored in:
83+
84+
src/types/uncertain/mod.rs
85+
86+
The mod.rs contains the type definition and constructors.
87+
88+
When the type implements multiple traits, each trait is stored within
89+
a file named after the implementing trait or trait group. For example,
90+
when implementing PartialEq and Debug for type Uncertain, these would be in
91+
files:
92+
93+
src/types/uncertain/uncertain_debug.rs
94+
src/types/uncertain/uncertain_part_eq.rs
95+
96+
## Optional src folders
7897
src/extensions/mod.rs # contains type extensions i.e. a default impl for a trait
7998
src/utils/mod.rs # contains utils
8099

0 commit comments

Comments
 (0)