Skip to content

Commit

Permalink
Add #[must_use] to All Custom Futures (#104)
Browse files Browse the repository at this point in the history
Without this it's very easy to forget awaiting the futures, leading to
possibly long debugging sessions.
  • Loading branch information
CryZe authored Dec 28, 2024
1 parent 2ab38e8 commit ebed573
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/emulator/gba/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ impl Emulator {
}

/// A future that executes a future until the emulator closes.
#[must_use = "You need to await this future."]
pub struct UntilEmulatorCloses<'a, F> {
emulator: &'a Emulator,
future: F,
Expand Down
1 change: 1 addition & 0 deletions src/emulator/gcn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ impl Emulator {
}

/// A future that executes a future until the emulator closes.
#[must_use = "You need to await this future."]
pub struct UntilEmulatorCloses<'a, F> {
emulator: &'a Emulator,
future: F,
Expand Down
1 change: 1 addition & 0 deletions src/emulator/genesis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ impl Emulator {
}

/// A future that executes a future until the emulator closes.
#[must_use = "You need to await this future."]
pub struct UntilEmulatorCloses<'a, F> {
emulator: &'a Emulator,
future: F,
Expand Down
1 change: 1 addition & 0 deletions src/emulator/ps1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ impl Emulator {
}

/// A future that executes a future until the emulator closes.
#[must_use = "You need to await this future."]
pub struct UntilEmulatorCloses<'a, F> {
emulator: &'a Emulator,
future: F,
Expand Down
1 change: 1 addition & 0 deletions src/emulator/ps2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl Emulator {
}

/// A future that executes a future until the emulator closes.
#[must_use = "You need to await this future."]
pub struct UntilEmulatorCloses<'a, F> {
emulator: &'a Emulator,
future: F,
Expand Down
1 change: 1 addition & 0 deletions src/emulator/sms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl Emulator {
}

/// A future that executes a future until the emulator closes.
#[must_use = "You need to await this future."]
pub struct UntilEmulatorCloses<'a, F> {
emulator: &'a Emulator,
future: F,
Expand Down
1 change: 1 addition & 0 deletions src/emulator/wii/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ impl Emulator {
}

/// A future that executes a future until the emulator closes.
#[must_use = "You need to await this future."]
pub struct UntilEmulatorCloses<'a, F> {
emulator: &'a Emulator,
future: F,
Expand Down
1 change: 1 addition & 0 deletions src/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ impl<const N: usize> Signature<N> {
}

/// A future that executes a future until the process closes.
#[must_use = "You need to await this future."]
pub struct UntilProcessCloses<'a, F> {
process: &'a Process,
future: F,
Expand Down
1 change: 1 addition & 0 deletions src/future/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ pub fn sleep(duration: Duration) -> Sleep {
/// // the future timed out
/// }
/// ```
#[must_use = "You need to await this future."]
pub struct Timeout<F> {
sleep: Sleep,
future: F,
Expand Down

0 comments on commit ebed573

Please sign in to comment.