A Rust-based command-line application for managing sales leads with progressive implementation stages.
- Add Leads: Store lead information (name, contact, value, status)
- Display Leads: View all leads in formatted table
- Remove Leads: Delete leads by ID
- Edit Leads: Modify existing lead details
- Cancel Edits: Revert changes during editing
- Data Validation: Input validation and error handling
- Add leads to vector storage
- Display all leads
- Simple 3-option menu
- Migrated from Vec to HashMap for better performance
- Added remove functionality
- ID-based lead lookup
- Edit existing leads
- Cancel edit operations with backup/restore
- Complete lead lifecycle management
src/
├── main.rs # Main application with switchable implementations
├── mods.rs # Data structures (Leads struct, LeadStatus enum)
├── hashmapfn.rs # HashMap operations
└── vecfn.rs # Vec operations
-
Clone Repository
git clone <repository-url> cd sales-lead-tracker
-
Install Rust (if not installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Run Application
cargo run
- Full functionality with remove/edit features
- Uses HashMap for efficient ID-based operations
In src/main.rs
:
- Comment out HashMap section
- Uncomment Vec section
- Run
cargo run
struct Leads {
id: u32,
name: String,
contact: String,
value: f64,
status: LeadStatus,
}
enum LeadStatus {
New,
Contacted,
Qualified,
Lost,
Converted,
}
Enter lead name: John Doe
Enter contact information: [email protected]
Enter lead value: 5000.00
Enter lead status: New
ID Name Contact Value Status
-----------------------------------------------------------------
1 John Doe [email protected] $5000.00 New
2 Jane Smith [email protected] $3500.00 Contacted
1. Edit Name 2. Edit Contact 3. Edit Value 4. Save
- From:
Vec<Leads>
with linear search - To:
HashMap<u32, Leads>
with direct ID access - Benefits: O(1) lookup, better scalability, efficient remove operations
=== Lead Management System ===
1. Add Lead
2. Display Leads
3. Remove Lead
4. Edit Lead
5. Cancel Edit
6. Exit
===================================
- Rust ownership and borrowing concepts
- Data structure selection and migration
- Error handling patterns
- Modular programming design
- Command-line interface development
- Progressive software development methodology