[][src]Struct amadeus_streaming::Sort

pub struct Sort<T, F> { /* fields omitted */ }

This data structure tracks the n top values given a stream. It uses only O(n) space.

Implementations

impl<T, F> Sort<T, F>[src]

pub fn new(cmp: F, n: usize) -> Self[src]

Create an empty Sort data structure with the specified n capacity.

pub fn capacity(&self) -> usize[src]

The n top elements we have capacity to track.

pub fn len(&self) -> usize[src]

The number of elements currently held.

pub fn is_empty(&self) -> bool[src]

If .len() == 0

pub fn clear(&mut self)[src]

Clears the Sort data structure, as if it was new.

pub fn iter(&self) -> Iter<'_, T>[src]

An iterator visiting all elements in ascending order. The iterator element type is &'_ T.

impl<T, F> Sort<T, F> where
    F: Fn(&T, &T) -> Ordering
[src]

pub fn push(&mut self, item: T)[src]

"Visit" an element.

Trait Implementations

impl<T, F> Add<Sort<T, F>> for Sort<T, F> where
    F: Fn(&T, &T) -> Ordering
[src]

type Output = Self

The resulting type after applying the + operator.

impl<T, F> AddAssign<Sort<T, F>> for Sort<T, F> where
    F: Fn(&T, &T) -> Ordering
[src]

impl<T: Clone, F: Clone> Clone for Sort<T, F>[src]

impl<T, F> Debug for Sort<T, F> where
    T: Debug
[src]

impl<'de, T, F> Deserialize<'de> for Sort<T, F> where
    T: Deserialize<'de>,
    F: Deserialize<'de> + for<'a> Fn<(&'a T, &'a T), Output = Ordering>, 
[src]

impl<T, F> IntoIterator for Sort<T, F>[src]

type Item = T

The type of the elements being iterated over.

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?

impl<T, F> Serialize for Sort<T, F> where
    T: Serialize,
    F: Serialize + for<'a> Fn<(&'a T, &'a T), Output = Ordering>, 
[src]

impl<T, F> Sum<Sort<T, F>> for Option<Sort<T, F>> where
    F: Fn(&T, &T) -> Ordering
[src]

Auto Trait Implementations

impl<T, F> RefUnwindSafe for Sort<T, F> where
    F: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, F> Send for Sort<T, F> where
    F: Send,
    T: Send

impl<T, F> Sync for Sort<T, F> where
    F: Sync,
    T: Sync

impl<T, F> Unpin for Sort<T, F> where
    F: Unpin,
    T: Unpin

impl<T, F> UnwindSafe for Sort<T, F> where
    F: UnwindSafe,
    T: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,