feat: Support incremental mode:

- Support incremental mode in heromodels
- Updated the example to refelct the changes
- Updated the tests to reflect the changes
This commit is contained in:
Mahmoud Emad
2025-05-17 11:12:09 +03:00
parent bd4770b99b
commit bde5db0e52
16 changed files with 1074 additions and 136 deletions

View File

@@ -40,7 +40,7 @@ fn main() {
.description("Brainstorming session for new project features.")
.add_attendee(attendee1.clone())
.add_attendee(attendee3.clone());
let event3_for_calendar2 = Event::new(
"event_gamma".to_string(),
"Client Call",
@@ -50,12 +50,15 @@ fn main() {
// --- Create Calendars ---
// Note: Calendar::new directly returns Calendar, no separate .build() step like the user example.
let calendar1 = Calendar::new(1, "Work Calendar")
// Create a calendar with auto-generated ID
let calendar1 = Calendar::new(None, "Work Calendar")
.description("Calendar for all work-related events.")
.add_event(event1.clone())
.add_event(event2.clone());
let calendar2 = Calendar::new(2, "Personal Calendar")
// Create a calendar with explicit ID
let calendar2 = Calendar::new(Some(2), "Personal Calendar")
.add_event(event3_for_calendar2.clone());
@@ -72,7 +75,7 @@ fn main() {
let stored_calendar1_opt = cal_collection.get_by_id(calendar1.get_id()).expect("can try to load calendar1");
assert!(stored_calendar1_opt.is_some(), "Calendar1 should be found in DB");
let mut stored_calendar1 = stored_calendar1_opt.unwrap();
println!("\nRetrieved calendar1 from DB: Name - '{}', Events count: {}", stored_calendar1.name, stored_calendar1.events.len());
assert_eq!(stored_calendar1.name, "Work Calendar");
assert_eq!(stored_calendar1.events.len(), 2);
@@ -87,7 +90,7 @@ fn main() {
println!("Rescheduling event '{}'...", event_to_update.title);
event_to_update.reschedule(new_start_time, new_end_time)
});
let rescheduled_event = stored_calendar1.events.iter().find(|e| e.id == event_id_to_reschedule)
.expect("Rescheduled event should exist");
assert_eq!(rescheduled_event.start_time, new_start_time);
@@ -123,7 +126,7 @@ fn main() {
println!("\nDeleted calendar2 (ID: {}) from DB.", calendar2.get_id());
println!("Calendar model DB Prefix: {}", Calendar::db_prefix());
println!("\nExample finished. DB stored at {}", db_path);
println!("To clean up, you can manually delete the directory: {}", db_path);
}