Struct imdb_index::Scored[][src]

pub struct Scored<T> { /* fields omitted */ }

Any value associated with a score.

We define Eq and Ord on this type in a way that ignores value and only uses the score to determine ordering. The public API of Scored guarantees that scores are never NaN.

Methods

impl<T> Scored<T>
[src]

Create a new value T with a score of 1.0.

Return the score for this item.

In general, no restrictions are placed on the range of scores, however most search APIs that use it will return scores in the range [0, 1].

The score returned is guaranteed to never be NaN.

Set the score, replacing the existing value with the given value.

This panics if the given score is NaN.

Consume this scored value and return a new scored value that drops the existing score and replaces it with the given score.

This panics if the given score is NaN.

Consume this scored value and map its value using the function given, returning a new scored value with the result of the map and an unchanged score.

Consume this scored value and map its score using the function given, return a new Scored with an unchanged value.

This panics if score returned by f is NaN.

Return a reference to the underlying value.

Consume this scored value, drop the score and return the underlying T.

Consume this scored value and return the underlying pair of score and T.

Trait Implementations

impl<T: Clone> Clone for Scored<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Copy> Copy for Scored<T>
[src]

impl<T: Debug> Debug for Scored<T>
[src]

Formats the value using the given formatter. Read more

impl<T: Default> Default for Scored<T>
[src]

Returns the "default value" for a type. Read more

impl<T> Eq for Scored<T>
[src]

impl<T> PartialEq for Scored<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T> Ord for Scored<T>
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<T> PartialOrd for Scored<T>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

impl<T> Send for Scored<T> where
    T: Send

impl<T> Sync for Scored<T> where
    T: Sync