Skip to content

Commit

Permalink
Merge pull request #7 from asynchronics/feature/stricter-checks
Browse files Browse the repository at this point in the history
Add stricter checks, implement Debug where needed
  • Loading branch information
sbarral authored Sep 8, 2024
2 parents fa29533 + 830d8f3 commit 97c073a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
//! assert_eq!(v, 42);
//! });
//! ```
#![warn(missing_docs, missing_debug_implementations, unreachable_pub)]

mod loom_exports;

use std::future::Future;
Expand All @@ -83,6 +85,7 @@ use loom_exports::sync::Mutex;
use pin_project_lite::pin_project;

/// An object that can receive or send notifications.
#[derive(Debug)]
pub struct Event {
wait_set: WaitSet,
}
Expand Down Expand Up @@ -220,6 +223,7 @@ unsafe impl Send for Notifier {}
unsafe impl Sync for Notifier {}

/// A future that can be `await`ed until a predicate is satisfied.
#[derive(Debug)]
pub struct WaitUntil<'a, F: FnMut() -> Option<T>, T> {
state: WaitUntilState,
predicate: F,
Expand Down Expand Up @@ -391,7 +395,7 @@ impl<'a, F: FnMut() -> Option<T>, T> Future for WaitUntil<'a, F, T> {
}

/// State of the `WaitUntil` future.
#[derive(PartialEq)]
#[derive(Debug, PartialEq)]
enum WaitUntilState {
Idle,
Polled(NonNull<Notifier>),
Expand Down Expand Up @@ -449,6 +453,7 @@ where
///
/// The set wraps a Mutex-protected list of notifiers and manages a flag for
/// fast assessment of list emptiness.
#[derive(Debug)]
struct WaitSet {
list: Mutex<List>,
is_empty: AtomicBool,
Expand Down Expand Up @@ -689,7 +694,7 @@ impl Default for WaitSet {
}
}

#[derive(Default)]
#[derive(Default, Debug)]
struct List {
front: Option<NonNull<Notifier>>,
back: Option<NonNull<Notifier>>,
Expand Down

0 comments on commit 97c073a

Please sign in to comment.