domain tier

domain-fulfillment

Order fulfillment, scheduling, and delivery for Rust applications

Order fulfillment, scheduling, and delivery for Rust applications

Tierdomain
Roleunclassified (baselined)
Pathcrates/domain/fulfillment
Edition2021
Targetsdomain_fulfillment
Public items90 across 0 modules
Tests18

What it is for

Fulfillment library crates for order processing, scheduling, and delivery.

This module provides generic types for managing order fulfillment workflows:

# Example

use domain_fulfillment::{Order, OrderStatus, FulfillmentMode, FulfillmentPlan};
use uuid::Uuid;

// Create an order
let order = Order::new(Uuid::new_v4());

// Create a fulfillment plan
let plan = FulfillmentPlan::new(order.id, FulfillmentMode::Delivery);

Capabilities

FulfillmentError

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum FulfillmentError

FulfillmentMode

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum FulfillmentMode
FulfillmentMode :: fn requires_delivery(& self) -> bool
FulfillmentMode :: fn requires_pickup(& self) -> bool
FulfillmentMode :: fn requires_routing(& self) -> bool
FulfillmentMode :: fn required_legs(& self) -> Vec <LegType>
FulfillmentMode :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

FulfillmentPlan

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub struct FulfillmentPlan
FulfillmentPlan :: fn new(order_id : Uuid, mode : FulfillmentMode) -> Self
FulfillmentPlan :: fn with_default_legs(order_id : Uuid, mode : FulfillmentMode) -> Self
FulfillmentPlan :: fn add_leg(& mut self, leg : ServiceLeg) -> Result <()>
FulfillmentPlan :: fn start(& mut self)
FulfillmentPlan :: fn complete(& mut self)
FulfillmentPlan :: fn cancel(& mut self)
FulfillmentPlan :: fn pending_leg_count(& self) -> usize
FulfillmentPlan :: fn completed_leg_count(& self) -> usize

FulfillmentStatus

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum FulfillmentStatus
FulfillmentStatus :: fn is_terminal(& self) -> bool
FulfillmentStatus :: fn can_modify_legs(& self) -> bool
FulfillmentStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

LegStatus

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum LegStatus
LegStatus :: fn is_terminal(& self) -> bool
LegStatus :: fn can_reassign(& self) -> bool
LegStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

LegType

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum LegType
LegType :: fn is_routed(& self) -> bool
LegType :: fn is_customer_action(& self) -> bool
LegType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

Order:Order

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub struct Order

Order:add

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn add_item(& mut self, item : OrderItem)

Order:cancel

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn cancel(& mut self) -> Result <()>

Order:complete

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn complete(& mut self) -> Result <()>

Order:fulfilled

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn fulfilled_item_count(& self) -> usize

Order:hold

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn hold(& mut self, reason : Option <String>)

Order:item

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn item_count(& self) -> usize

Order:mark

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn mark_ready(& mut self) -> Result <()>

Order:new

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn new(customer_id : Uuid) -> Self

Order:start

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn start_processing(& mut self) -> Result <()>

Order:submit

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn submit(& mut self) -> Result <()>

Order:with

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Order :: fn with_order_number(mut self, number : impl Into <String>) -> Self
Order :: fn with_requested_date(mut self, date : NaiveDate) -> Self

OrderItem

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub struct OrderItem
OrderItem :: fn new(order_id : Uuid, name : impl Into <String>, quantity : i32) -> Self
OrderItem :: fn with_catalog_item(mut self, catalog_item_id : Uuid) -> Self
OrderItem :: fn with_unit_price(mut self, cents : i64) -> Self
OrderItem :: fn total_cents(& self) -> Option <i64>
OrderItem :: fn fulfill(& mut self)
OrderItem :: fn cancel(& mut self)

OrderItemStatus

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum OrderItemStatus
OrderItemStatus :: fn is_terminal(& self) -> bool
OrderItemStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

OrderStatus

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum OrderStatus
OrderStatus :: fn is_terminal(& self) -> bool
OrderStatus :: fn is_modifiable(& self) -> bool
OrderStatus :: fn can_cancel(& self) -> bool
OrderStatus :: fn valid_transitions(& self) -> Vec <OrderStatus>
OrderStatus :: fn can_transition_to(& self, target : OrderStatus) -> bool
OrderStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

Result

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub type Result<T>: std::result::Result <T, FulfillmentError>

Run:Run

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub struct Run

Run:add

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn add_leg(& mut self, leg_id : Uuid) -> Result <()>

Run:cancel

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn cancel(& mut self)

Run:complete

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn complete(& mut self)

Run:leg

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn leg_count(& self) -> usize

Run:lock

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn lock(& mut self)

Run:new

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn new(scheduled_date : NaiveDate) -> Self

Run:publish

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn publish(& mut self)

Run:remove

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn remove_leg(& mut self, leg_id : Uuid) -> Result <()>

Run:start

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn start(& mut self)

Run:with

Fulfillment library crates for order processing, scheduling, and delivery.

Item
Run :: fn with_name(mut self, name : impl Into <String>) -> Self
Run :: fn with_driver(mut self, driver_id : Uuid) -> Self
Run :: fn with_vehicle(mut self, vehicle_id : Uuid) -> Self

RunStatus

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum RunStatus
RunStatus :: fn allows_leg_changes(& self) -> bool
RunStatus :: fn is_modifiable(& self) -> bool
RunStatus :: fn is_terminal(& self) -> bool
RunStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

ServiceLeg

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub struct ServiceLeg
ServiceLeg :: fn new(plan_id : Uuid, leg_type : LegType) -> Self
ServiceLeg :: fn assign_to_run(& mut self, run_id : Uuid) -> Result <()>
ServiceLeg :: fn start(& mut self)
ServiceLeg :: fn complete(& mut self)
ServiceLeg :: fn fail(& mut self, reason : Option <String>)
ServiceLeg :: fn skip(& mut self, reason : Option <String>)
ServiceLeg :: fn duration(& self) -> Option <chrono::Duration>

StopType

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub enum StopType
StopType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result

TimeSlot

Fulfillment library crates for order processing, scheduling, and delivery.

Item
pub struct TimeSlot
TimeSlot :: fn new(name : impl Into <String>, start : NaiveTime, end : NaiveTime) -> Self
TimeSlot :: fn duration_minutes(& self) -> i64

How to use it

From this crate's own rustdoc:

use domain_fulfillment::{Order, OrderStatus, FulfillmentMode, FulfillmentPlan};
use uuid::Uuid;

// Create an order
let order = Order::new(Uuid::new_v4());

// Create a fulfillment plan
let plan = FulfillmentPlan::new(order.id, FulfillmentMode::Delivery);

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum FulfillmentErrorErrors that can occur during fulfillment operations.
pub type Result<T>: std::result::Result <T, FulfillmentError>Result type for fulfillment operations.
pub enum OrderStatusStatus of an order in the fulfillment pipeline.
OrderStatus :: fn is_terminal(& self) -> boolCheck if this is a terminal status.
OrderStatus :: fn is_modifiable(& self) -> boolCheck if the order can be modified.
OrderStatus :: fn can_cancel(& self) -> boolCheck if the order can be cancelled.
OrderStatus :: fn valid_transitions(& self) -> Vec <OrderStatus>Get valid next statuses from current status.
OrderStatus :: fn can_transition_to(& self, target : OrderStatus) -> boolCheck if transition to target status is valid.
OrderStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub enum OrderItemStatusStatus of an individual order item.
OrderItemStatus :: fn is_terminal(& self) -> boolCheck if this is a terminal status.
OrderItemStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub enum FulfillmentModeHow the order will be fulfilled (delivery method).
FulfillmentMode :: fn requires_delivery(& self) -> boolCheck if this mode requires physical delivery.
FulfillmentMode :: fn requires_pickup(& self) -> boolCheck if this mode requires pickup from customer.
FulfillmentMode :: fn requires_routing(& self) -> boolCheck if this mode requires routing/scheduling.
FulfillmentMode :: fn required_legs(& self) -> Vec <LegType>Get the leg types needed for this fulfillment mode.
FulfillmentMode :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub enum FulfillmentStatusStatus of a fulfillment plan.
FulfillmentStatus :: fn is_terminal(& self) -> boolCheck if this is a terminal status.
FulfillmentStatus :: fn can_modify_legs(& self) -> boolCheck if plan can have legs modified.
FulfillmentStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub enum LegTypeType of service leg in a fulfillment plan.
LegType :: fn is_routed(& self) -> boolCheck if this leg type requires routing.
LegType :: fn is_customer_action(& self) -> boolCheck if this leg involves customer coming to location.
LegType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub enum LegStatusStatus of a service leg.
LegStatus :: fn is_terminal(& self) -> boolCheck if this is a terminal status.
LegStatus :: fn can_reassign(& self) -> boolCheck if leg can be reassigned.
LegStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub enum RunStatusStatus of a delivery/pickup run.
RunStatus :: fn allows_leg_changes(& self) -> boolCheck if the run can have legs assigned/removed.
RunStatus :: fn is_modifiable(& self) -> boolCheck if run is modifiable at all.
RunStatus :: fn is_terminal(& self) -> boolCheck if this is a terminal status.
RunStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub struct TimeSlotTime slot for scheduling deliveries/pickups.
TimeSlot :: fn new(name : impl Into <String>, start : NaiveTime, end : NaiveTime) -> SelfCreate a new time slot.
TimeSlot :: fn duration_minutes(& self) -> i64Get slot duration in minutes.
pub enum StopTypeType of stop/location.
StopType :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result
pub struct OrderAn order for fulfillment.
Order :: fn new(customer_id : Uuid) -> SelfCreate a new order.
Order :: fn with_order_number(mut self, number : impl Into <String>) -> SelfSet order number.
Order :: fn with_requested_date(mut self, date : NaiveDate) -> SelfSet requested date.
Order :: fn add_item(& mut self, item : OrderItem)Add an item to the order.
Order :: fn submit(& mut self) -> Result <()>Submit the order.
Order :: fn start_processing(& mut self) -> Result <()>Start processing the order.
Order :: fn mark_ready(& mut self) -> Result <()>Mark order as ready.
Order :: fn complete(& mut self) -> Result <()>Complete the order.
Order :: fn cancel(& mut self) -> Result <()>Cancel the order.
Order :: fn hold(& mut self, reason : Option <String>)Put order on hold.
Order :: fn item_count(& self) -> usizeGet count of items.
Order :: fn fulfilled_item_count(& self) -> usizeGet count of fulfilled items.
pub struct OrderItemAn item within an order.
OrderItem :: fn new(order_id : Uuid, name : impl Into <String>, quantity : i32) -> SelfCreate a new order item.
OrderItem :: fn with_catalog_item(mut self, catalog_item_id : Uuid) -> SelfSet catalog item reference.
OrderItem :: fn with_unit_price(mut self, cents : i64) -> SelfSet unit price.
OrderItem :: fn total_cents(& self) -> Option <i64>Calculate total price in cents.
OrderItem :: fn fulfill(& mut self)Mark item as fulfilled.
OrderItem :: fn cancel(& mut self)Cancel the item.
pub struct FulfillmentPlanA plan for fulfilling an order.
FulfillmentPlan :: fn new(order_id : Uuid, mode : FulfillmentMode) -> SelfCreate a new fulfillment plan.
FulfillmentPlan :: fn with_default_legs(order_id : Uuid, mode : FulfillmentMode) -> SelfCreate a plan with auto-generated legs based on mode.
FulfillmentPlan :: fn add_leg(& mut self, leg : ServiceLeg) -> Result <()>Add a service leg.
FulfillmentPlan :: fn start(& mut self)Start the plan.
FulfillmentPlan :: fn complete(& mut self)Complete the plan.
FulfillmentPlan :: fn cancel(& mut self)Cancel the plan.
FulfillmentPlan :: fn pending_leg_count(& self) -> usizeGet count of pending legs.
FulfillmentPlan :: fn completed_leg_count(& self) -> usizeGet count of completed legs.
pub struct ServiceLegA single leg of a fulfillment plan (e.g., delivery, pickup).
ServiceLeg :: fn new(plan_id : Uuid, leg_type : LegType) -> SelfCreate a new service leg.
ServiceLeg :: fn assign_to_run(& mut self, run_id : Uuid) -> Result <()>Assign to a run.
ServiceLeg :: fn start(& mut self)Start the leg.
ServiceLeg :: fn complete(& mut self)Complete the leg.
ServiceLeg :: fn fail(& mut self, reason : Option <String>)Fail the leg.
ServiceLeg :: fn skip(& mut self, reason : Option <String>)Skip the leg.
ServiceLeg :: fn duration(& self) -> Option <chrono::Duration>Get duration if completed.
pub struct RunA delivery/pickup run containing multiple legs.
Run :: fn new(scheduled_date : NaiveDate) -> SelfCreate a new run.
Run :: fn with_name(mut self, name : impl Into <String>) -> SelfSet name.
Run :: fn with_driver(mut self, driver_id : Uuid) -> SelfSet driver.
Run :: fn with_vehicle(mut self, vehicle_id : Uuid) -> SelfSet vehicle.
Run :: fn add_leg(& mut self, leg_id : Uuid) -> Result <()>Add a leg to the run.
Run :: fn remove_leg(& mut self, leg_id : Uuid) -> Result <()>Remove a leg from the run.
Run :: fn publish(& mut self)Publish the run.
Run :: fn lock(& mut self)Lock the run.
Run :: fn start(& mut self)Start the run.
Run :: fn complete(& mut self)Complete the run.
Run :: fn cancel(& mut self)Cancel the run.
Run :: fn leg_count(& self) -> usizeGet leg count.

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

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)
Locationcrates/domain/fulfillment
Vocabulary in force (lexicon)current

Dependencies

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
serde^1derivenoalways
serde_json^1noalways
thiserror^2noalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio^1fullnoalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_fulfillment["application-fulfillment"] -->|uses| SELF
  SELF["domain-fulfillment"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libdomain_fulfillment`src/lib.rs`

Error model

Error typeNamed by
FulfillmentErrorResult

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone 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.

1 workspace crate depends on this one: application-fulfillment.

Verification

KindCount
Unit tests18
Integration tests0
Examples0
Doctests1

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root1604

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc8290
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 82
    "No rustdoc detected" : 8

Metrics

MetricValue
Rust source files1
Source lines1325
Code lines968
Public API items90
Public modules0
Tests18
Examples0
Cargo features0
Direct runtime dependencies5
Workspace reverse dependencies1
pie showData
    title Public API by kind
    "enum" : 9
    "method" : 74
    "struct" : 6
    "type alias" : 1
pie showData
    title Rust source composition
    "Code" : 968
    "Blank or comment" : 357

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.

All domain · Manual