Skip to content

Commit

Permalink
fix: Add use directives to fix doc code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
galenseilis committed Oct 3, 2024
1 parent 1714f57 commit 691c8b8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion desru/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl Event {
///
/// # Example
/// ```
/// use std::collections::HashMap;
/// use desru::{Event};
///
/// let event = Event::new(5.0, None, None);
/// assert_eq!(event.time, 5.0);
Expand All @@ -151,6 +151,8 @@ impl Event {
///
/// # Example
/// ```
/// use desru::{Event};
///
/// let mut event = Event::new(0.0, Some(Box::new(|| Some("Executed".to_string()))), None);
/// assert_eq!(event.run(), Some("Executed".to_string()));
/// ```
Expand Down Expand Up @@ -216,6 +218,8 @@ impl EventScheduler {
///
/// # Example
/// ```
/// use desru::{EventScheduler};
///
/// let scheduler = EventScheduler::new();
/// assert_eq!(scheduler.current_time, 0.0);
/// ```
Expand All @@ -234,6 +238,8 @@ impl EventScheduler {
///
/// # Example
/// ```
/// use desru::{Event, EventScheduler};
///
/// let mut scheduler = EventScheduler::new();
/// let event = Event::new(5.0, None, None);
/// scheduler.schedule(event);
Expand All @@ -251,6 +257,8 @@ impl EventScheduler {
///
/// # Example
/// ```
/// use desru::EventScheduler;
///
/// let mut scheduler = EventScheduler::new();
/// scheduler.timeout(10.0, Some(Box::new(|| Some("Timeout event".to_string()))), None);
/// ```
Expand All @@ -270,6 +278,8 @@ impl EventScheduler {
///
/// # Example
/// ```
/// use desru::{Event, EventScheduler};
///
/// let mut scheduler = EventScheduler::new();
/// scheduler.timeout(5.0, Some(Box::new(|| Some("Event executed".to_string()))), None);
/// let stop_fn = Box::new(|s: &EventScheduler| s.current_time >= 10.0);
Expand Down Expand Up @@ -303,6 +313,8 @@ impl EventScheduler {
///
/// # Example
/// ```
/// use desru::{Event, EventScheduler};
///
/// let mut scheduler = EventScheduler::new();
/// scheduler.timeout(5.0, Some(Box::new(|| Some("Timeout event".to_string()))), None);
/// scheduler.run_until_max_time(10.0);
Expand Down

0 comments on commit 691c8b8

Please sign in to comment.