_No description in Cargo.toml._
| Tier | domain |
| Role | unclassified (baselined) |
| Path | crates/domain/storage-locations |
| Edition | 2021 |
| Targets | domain_storage_locations |
| Public items | 26 across 0 modules |
| Tests | 36 |
What it is for
Storage location library crates: nested physical containment hierarchies.
Models the "Russian doll" pattern of physical storage — a building contains floors, floors contain rooms, rooms contain shelves, shelves contain bins. Each level nests inside exactly one parent, forming a strict tree.
This is NOT geographic (use domain-geo::Place for that). This models the internal organization of space within a physical location.
# Examples
use domain_storage_locations::{StorageLocation, LocationType};
use foundation_basemodels::HasId;
let building = StorageLocation::new("Warehouse A", LocationType::Building);
let room = StorageLocation::new("Room 101", LocationType::Room)
.with_parent(building.id());
let shelf = StorageLocation::new("Shelf 3", LocationType::Shelf)
.with_parent(room.id());
Capabilities
crate root
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
fn validate_nesting(parent_type : & LocationType, child_type : & LocationType) -> Result <()> |
fn validate_root(location_type : & LocationType) -> Result <()> |
fn build_path(ancestors : & & str, name : & str) -> String |
LocationType
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
pub enum LocationType |
LocationType :: fn depth(& self) -> u8 |
LocationType :: fn can_contain(& self, child : & LocationType) -> bool |
LocationType :: fn can_be_root(& self) -> bool |
LocationType :: fn as_str(& self) -> & 'static str |
LocationType :: fn parse(s : & str) -> Option <Self> |
LocationType :: fn all() -> & 'static LocationType |
LocationType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
Result
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
pub type Result<T>: std::result::Result <T, StorageLocationError> |
StorageLocation:StorageLocation
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
pub struct StorageLocation |
StorageLocation:created
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
StorageLocation :: fn created_at(& self) -> DateTime <Utc> |
StorageLocation:deleted
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
StorageLocation :: fn deleted_at(& self) -> Option <DateTime <Utc>> |
StorageLocation:id
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
StorageLocation :: fn id(& self) -> Uuid |
StorageLocation:is
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
StorageLocation :: fn is_root(& self) -> bool |
StorageLocation:new
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
StorageLocation :: fn new(name : impl Into <String>, location_type : LocationType) -> Self |
StorageLocation:updated
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
StorageLocation :: fn updated_at(& self) -> DateTime <Utc> |
StorageLocation:with
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
StorageLocation :: fn with_parent(mut self, parent_id : Uuid) -> Self |
StorageLocation :: fn with_place(mut self, place_id : Uuid) -> Self |
StorageLocation :: fn with_description(mut self, description : impl Into <String>) -> Self |
StorageLocation :: fn with_code(mut self, code : impl Into <String>) -> Self |
StorageLocation :: fn with_default_workflow(mut self, workflow : impl Into <String>) -> Self |
StorageLocation :: fn with_category_tag(mut self, tag_id : Uuid) -> Self |
StorageLocationError
Storage location library crates: nested physical containment hierarchies.
| Item |
|---|
pub enum StorageLocationError |
How to use it
From this crate's own rustdoc:
use domain_storage_locations::{StorageLocation, LocationType};
use foundation_basemodels::HasId;
let building = StorageLocation::new("Warehouse A", LocationType::Building);
let room = StorageLocation::new("Room 101", LocationType::Room)
.with_parent(building.id());
let shelf = StorageLocation::new("Shelf 3", LocationType::Shelf)
.with_parent(room.id());
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub enum StorageLocationError | Errors for storage location operations. |
pub type Result<T>: std::result::Result <T, StorageLocationError> | Result type for storage location operations. |
pub enum LocationType | Type of storage location in the containment hierarchy |
LocationType :: fn depth(& self) -> u8 | Returns the nesting depth (0 = outermost). |
LocationType :: fn can_contain(& self, child : & LocationType) -> bool | Returns true if this type can contain the given child type |
LocationType :: fn can_be_root(& self) -> bool | Returns true if this type can be a root (no parent). |
LocationType :: fn as_str(& self) -> & 'static str | String representation. |
LocationType :: fn parse(s : & str) -> Option <Self> | Parse from string (case-insensitive). |
LocationType :: fn all() -> & 'static LocationType | Returns all valid types. |
LocationType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
pub struct StorageLocation | A node in a physical containment hierarchy |
StorageLocation :: fn new(name : impl Into <String>, location_type : LocationType) -> Self | Create a new storage location. |
StorageLocation :: fn with_parent(mut self, parent_id : Uuid) -> Self | Set the parent location. |
StorageLocation :: fn with_place(mut self, place_id : Uuid) -> Self | Link to a geo Place. |
StorageLocation :: fn with_description(mut self, description : impl Into <String>) -> Self | Set description. |
StorageLocation :: fn with_code(mut self, code : impl Into <String>) -> Self | Set the location code. |
StorageLocation :: fn with_default_workflow(mut self, workflow : impl Into <String>) -> Self | Set the per-location default entry workflow slug (Sprint 0.10) |
StorageLocation :: fn with_category_tag(mut self, tag_id : Uuid) -> Self | Set the category tag soft-reference (Sprint 0.10). |
StorageLocation :: fn is_root(& self) -> bool | Check if this is a root location (no parent). |
StorageLocation :: fn id(& self) -> Uuid | — |
StorageLocation :: fn created_at(& self) -> DateTime <Utc> | — |
StorageLocation :: fn updated_at(& self) -> DateTime <Utc> | — |
StorageLocation :: fn deleted_at(& self) -> Option <DateTime <Utc>> | — |
fn validate_nesting(parent_type : & LocationType, child_type : & LocationType) -> Result <()> | Validate that a child type can nest inside a parent type |
fn validate_root(location_type : & LocationType) -> Result <()> | Validate that a location can be a root (no parent) |
fn build_path(ancestors : & & str, name : & str) -> String | Build the full path string for a location given its ancestors (root first) |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into foundation.
Shares tier domain with 41 other crates: domain-agreements, domain-ai-report, domain-billing, domain-catalog, domain-classify, domain-comments, domain-competitive-intel, domain-contact, … (41 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | domain |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/domain/storage-locations |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_domain["domain"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-basemodels` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | yes | always |
thiserror | ^2 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development. None.
Build. None.
Depended on by. 2 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_catalog["application-catalog"] -->|uses| SELF n_application_storage_locations["application-storage-locations"] -->|uses| SELF SELF["domain-storage-locations"] SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
| Feature | Enables | On by default |
|---|---|---|
default | — | yes |
postgres | dep:sqlx | no |
flowchart LR n_default["default"] n_postgres["postgres"] --> n_dep_sqlx["dep:sqlx"]
Targets
| Kind | Name | Source |
|---|---|---|
| lib | domain_storage_locations | `src/lib.rs` |
Error model
| Error type | Named by |
|---|---|
StorageLocationError | Result |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | yes |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
2 workspace crates depend on this one: application-catalog, application-storage-locations.
Verification
| Kind | Count |
|---|---|
| Unit tests | 36 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 1 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 7 | 0 | 4 |
What the tests establish, by name:
test_all_types_count—src/lib.rstest_bin_cannot_contain_anything—src/lib.rstest_build_path_deep—src/lib.rstest_build_path_nested—src/lib.rstest_build_path_root—src/lib.rstest_builder_chain—src/lib.rstest_building_can_contain_bin—src/lib.rstest_building_can_contain_floor—src/lib.rstest_building_can_contain_room—src/lib.rstest_child_cannot_contain_parent—src/lib.rstest_display—src/lib.rstest_error_invalid_hierarchy_message—src/lib.rstest_error_invalid_root_message—src/lib.rstest_implements_base_traits—src/lib.rstest_location_type_depth_ordering—src/lib.rstest_new_storage_location—src/lib.rstest_new_storage_location_defaults_workflow_and_category_to_none—src/lib.rstest_parse_case_insensitive—src/lib.rstest_parse_invalid—src/lib.rstest_parse_roundtrip—src/lib.rstest_root_types—src/lib.rstest_same_type_cannot_contain_itself—src/lib.rstest_serde_roundtrip_with_none_fields_preserves_none—src/lib.rstest_serialization_roundtrip—src/lib.rstest_two_locations_unique_ids—src/lib.rstest_validate_nesting_invalid—src/lib.rstest_validate_nesting_valid—src/lib.rstest_validate_root_invalid—src/lib.rstest_validate_root_valid—src/lib.rstest_with_category_tag—src/lib.rs- _… 6 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 21 | 26 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 21
"No rustdoc detected" : 5
Metrics
| Metric | Value |
|---|---|
| Rust source files | 1 |
| Source lines | 681 |
| Code lines | 490 |
| Public API items | 26 |
| Public modules | 0 |
| Tests | 36 |
| Examples | 0 |
| Cargo features | 2 |
| Direct runtime dependencies | 7 |
| Workspace reverse dependencies | 2 |
pie showData
title Public API by kind
"enum" : 2
"function" : 3
"method" : 19
"struct" : 1
"type alias" : 1
pie showData
title Rust source composition
"Code" : 490
"Blank or comment" : 191
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.