pub fn push(&mut self, future: T) -> usize {
        let index = self.slab.insert(future);

        let (old, new) = {
            // Safety: At this point we know we have exclusive access to the set.
            let set = unsafe { (*self.alternate).as_mut_set() };
            let old = set.capacity();
            set.set(index);
            let new = set.capacity();
            (old, new)
        };

        // Fast Path: Did not grow the alternate set, so no need to grow the
        // active set either.
        if new <= old {
            return index;
        }

        // Slow Path: Swap out the active set and grow it to accomodate the same
        // number of elements as the now alternate set was grown to.
        // This works out, because if it's non-empty, the next time we poll
        // the unordered set it will be processed. It it's empty, it will be
        // swapped out with the active set which now contains the newly added
        // futures.
        // Safety: We have unique access to the alternate set being modified.
        unsafe {
            self.shared.swap_active(&mut self.alternate).reserve(new);
        }

        index
    }
/// Push the given future or stream to [Unordered] and return its task
/// index.
///
/// Newly added futures are guaranteed to be polled, but there is no
/// guarantee in which order this will happen.
///
/// Pushed tasks are pinned by the [Unordered] collection automatically.
///
/// # Examples
///
/// ```rust
/// use unicycle::FuturesUnordered;
///
/// let mut futures = FuturesUnordered::new();
/// assert!(futures.is_empty());
/// futures.push(async { 42 });
/// assert!(!futures.is_empty());
/// ```
Push the given future or stream to [Unordered] and return its task
index.

Newly added futures are guaranteed to be polled, but there is no
guarantee in which order this will happen.

Pushed tasks are pinned by the [Unordered] collection automatically.
Push the given future or stream to [ Unordered ] and return its task index . Newly added futures are guaranteed to be polled but there is no guarantee in which order this will happen . Pushed tasks are pinned by the [ Unordered ] collection automatically .
pub fn push(&mut self, future: T) -> usize {
        let index = self.slab.insert(future);
        let (old, new) = {
            // Safety: At this point we know we have exclusive access to the set.
            let set = unsafe { (*self.alternate).as_mut_set() };
            let old = set.capacity();
            set.set(index);
            let new = set.capacity();
            (old, new)
        };
        // Fast Path: Did not grow the alternate set, so no need to grow the
        // active set either.
        if new <= old {
            return index;
        }
        // Slow Path: Swap out the active set and grow it to accomodate the same
        // number of elements as the now alternate set was grown to.
        // This works out, because if it's non-empty, the next time we poll
        // the unordered set it will be processed. It it's empty, it will be
        // swapped out with the active set which now contains the newly added
        // futures.
        // Safety: We have unique access to the alternate set being modified.
        unsafe {
            self.shared.swap_active(&mut self.alternate).reserve(new);
        }
        index
    }
pub fn push ( & mut self , future : T ) -> usize { let index = self . slab . insert ( future ) ; let ( old , new ) = { // Safety: At this point we know we have exclusive access to the set. let set = unsafe { ( * self . alternate ) . as_mut_set ( ) } ; let old = set . capacity ( ) ; set . set ( index ) ; let new = set . capacity ( ) ; ( old , new ) } ; // Fast Path: Did not grow the alternate set, so no need to grow the // active set either. if new <= old { return index ; } // Slow Path: Swap out the active set and grow it to accomodate the same // number of elements as the now alternate set was grown to. // This works out, because if it's non-empty, the next time we poll // the unordered set it will be processed. It it's empty, it will be // swapped out with the active set which now contains the newly added // futures. // Safety: We have unique access to the alternate set being modified. unsafe { self . shared . swap_active ( & mut self . alternate ) . reserve ( new ) ; } index }
Push the given future or stream to [Unordered] and return its task
index.
Push the given future or stream to [ Unordered ] and return its task index .
&mut self
future
T
&mut self
future
T
examples
```rust
use unicycle::FuturesUnordered.


` ` ` rust use unicycle :: FuturesUnordered .