qubit_lock/monitor/async_timeout_notification_waiter.rs
1/*******************************************************************************
2 *
3 * Copyright (c) 2025 - 2026 Haixing Hu.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10//! Asynchronous timeout notification-wait capability.
11
12use std::time::Duration;
13
14use crate::monitor::{
15 AsyncMonitorFuture,
16 WaitTimeoutStatus,
17};
18
19/// Waits asynchronously for a notification with a relative timeout.
20pub trait AsyncTimeoutNotificationWaiter {
21 /// Returns a future that resolves after notification or timeout.
22 ///
23 /// # Arguments
24 ///
25 /// * `timeout` - Maximum relative duration to wait, measured from this
26 /// method call.
27 ///
28 /// # Returns
29 ///
30 /// A future resolving to the timeout status.
31 fn async_wait_for<'a>(&'a self, timeout: Duration)
32 -> AsyncMonitorFuture<'a, WaitTimeoutStatus>;
33}