pub fn reset_at(&mut self, key: &Key, when: Instant) {
        self.remove_key(key);

        // Normalize the deadline. Values cannot be set to expire in the past.
        let when = self.normalize_deadline(when);

        self.slab[key.index].when = when;
        self.slab[key.index].expired = false;

        self.insert_idx(when, key.index);

        let next_deadline = self.next_deadline();
        if let (Some(ref mut delay), Some(deadline)) = (&mut self.delay, next_deadline) {
            // This should awaken us if necessary (ie, if already expired)
            delay.as_mut().reset(deadline);
        }
    }
/// Sets the delay of the item associated with `key` to expire at `when`.
///
/// This function is identical to `reset` but takes an `Instant` instead of
/// a `Duration`.
///
/// The item remains in the queue but the delay is set to expire at `when`.
/// If `when` is in the past, then the item is immediately made available to
/// the caller.
///
/// # Panics
///
/// This function panics if `when` is too far in the future or if `key` is
/// not contained by the queue.
///
/// # Examples
///
/// Basic usage
///
/// ```rust
/// use tokio::time::{Duration, Instant};
/// use tokio_util::time::DelayQueue;
///
/// # #[tokio::main]
/// # async fn main() {
/// let mut delay_queue = DelayQueue::new();
/// let key = delay_queue.insert("foo", Duration::from_secs(5));
///
/// // "foo" is scheduled to be returned in 5 seconds
///
/// delay_queue.reset_at(&key, Instant::now() + Duration::from_secs(10));
///
/// // "foo" is now scheduled to be returned in 10 seconds
/// # }
/// ```
Sets the delay of the item associated with `key` to expire at `when`.

The item remains in the queue but the delay is set to expire at `when`.
If `when` is in the past, then the item is immediately made available to
the caller.
Sets the delay of the item associated with ` key ` to expire at ` when ` . The item remains in the queue but the delay is set to expire at ` when ` . If ` when ` is in the past then the item is immediately made available to the caller .
pub fn reset_at(&mut self, key: &Key, when: Instant) {
        self.remove_key(key);
        // Normalize the deadline. Values cannot be set to expire in the past.
        let when = self.normalize_deadline(when);
        self.slab[key.index].when = when;
        self.slab[key.index].expired = false;
        self.insert_idx(when, key.index);
        let next_deadline = self.next_deadline();
        if let (Some(ref mut delay), Some(deadline)) = (&mut self.delay, next_deadline) {
            // This should awaken us if necessary (ie, if already expired)
            delay.as_mut().reset(deadline);
        }
    }
pub fn reset_at ( & mut self , key : & Key , when : Instant ) { self . remove_key ( key ) ; // Normalize the deadline. Values cannot be set to expire in the past. let when = self . normalize_deadline ( when ) ; self . slab [ key . index ] . when = when ; self . slab [ key . index ] . expired = false ; self . insert_idx ( when , key . index ) ; let next_deadline = self . next_deadline ( ) ; if let ( Some ( ref mut delay ) , Some ( deadline ) ) = ( & mut self . delay , next_deadline ) { // This should awaken us if necessary (ie, if already expired) delay . as_mut ( ) . reset ( deadline ) ; } }
Sets the delay of the item associated with `key` to expire at `when`.
Sets the delay of the item associated with ` key ` to expire at ` when ` .
&mut self
key
&Key
when
Instant
panics
This function panics if `when` is too far in the future or if `key` is
not contained by the queue.
This function panics if ` when ` is too far in the future or if ` key ` is not contained by the queue .
examples
Basic usage

```rust
use tokio::time::{Duration, Instant};
use tokio_util::time::DelayQueue.
Basic usage ` ` ` rust use tokio :: time :: { Duration Instant } ; use tokio_util :: time :: DelayQueue .
#[tokio::main]
None
async fn main() {
let mut delay_queue = DelayQueue::new();
let key = delay_queue.insert("foo", Duration::from_secs(5)).

"foo" is scheduled to be returned in 5 seconds

delay_queue.reset_at(&key, Instant::now() + Duration::from_secs(10)).

"foo" is now scheduled to be returned in 10 seconds
let mut delay_queue = DelayQueue :: new () ; let key = delay_queue . insert ( " foo " Duration :: from_secs ( 5 )) . " foo " is scheduled to be returned in 5 seconds delay_queue . reset_at ( &key Instant :: now () + Duration :: from_secs ( 10 )) . " foo " is now scheduled to be returned in 10 seconds
}
None