File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,28 @@ src/errors/mod.rs # contains each error type in a separate file
7272src/traits/mod.rs # contains each trait in a separate file
7373src/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
7897src/extensions/mod.rs # contains type extensions i.e. a default impl for a trait
7998src/utils/mod.rs # contains utils
8099
You can’t perform that action at this time.
0 commit comments