pub fn mime_precedence(&self) -> Vec<Mime> {
        let mut types = self.0.clone();

        // use stable sort so items with equal q-factor and specificity retain listed order
        types.sort_by(|a, b| {
            // sort by q-factor descending
            b.quality.cmp(&a.quality).then_with(|| {
                // use specificity rules on mime types with
                // same q-factor (eg. text/html > text/* > */*)

                // subtypes are not comparable if main type is star, so return
                match (a.item.type_(), b.item.type_()) {
                    (mime::STAR, mime::STAR) => return Ordering::Equal,

                    // a is sorted after b
                    (mime::STAR, _) => return Ordering::Greater,

                    // a is sorted before b
                    (_, mime::STAR) => return Ordering::Less,

                    _ => {}
                }

                // in both these match expressions, the returned ordering appears
                // inverted because sort is high-to-low ("descending") precedence
                match (a.item.subtype(), b.item.subtype()) {
                    (mime::STAR, mime::STAR) => Ordering::Equal,

                    // a is sorted after b
                    (mime::STAR, _) => Ordering::Greater,

                    // a is sorted before b
                    (_, mime::STAR) => Ordering::Less,

                    _ => Ordering::Equal,
                }
            })
        });

        types.into_iter().map(|qitem| qitem.item).collect()
    }
/// Returns a sorted list of mime types from highest to lowest preference, accounting for
/// [q-factor weighting] and specificity.
///
/// [q-factor weighting]: https://tools.ietf.org/html/rfc7231#section-5.3.2
Returns a sorted list of mime types from highest to lowest preference, accounting for
[q-factor weighting] and specificity.


Returns a sorted list of mime types from highest to lowest preference accounting for [ q - factor weighting ] and specificity .
pub fn mime_precedence(&self) -> Vec<Mime> {
        let mut types = self.0.clone();
        // use stable sort so items with equal q-factor and specificity retain listed order
        types.sort_by(|a, b| {
            // sort by q-factor descending
            b.quality.cmp(&a.quality).then_with(|| {
                // use specificity rules on mime types with
                // same q-factor (eg. text/html > text/* > */*)
                // subtypes are not comparable if main type is star, so return
                match (a.item.type_(), b.item.type_()) {
                    (mime::STAR, mime::STAR) => return Ordering::Equal,
                    // a is sorted after b
                    (mime::STAR, _) => return Ordering::Greater,
                    // a is sorted before b
                    (_, mime::STAR) => return Ordering::Less,
                    _ => {}
                }
                // in both these match expressions, the returned ordering appears
                // inverted because sort is high-to-low ("descending") precedence
                match (a.item.subtype(), b.item.subtype()) {
                    (mime::STAR, mime::STAR) => Ordering::Equal,
                    // a is sorted after b
                    (mime::STAR, _) => Ordering::Greater,
                    // a is sorted before b
                    (_, mime::STAR) => Ordering::Less,
                    _ => Ordering::Equal,
                }
            })
        });
        types.into_iter().map(|qitem| qitem.item).collect()
    }
pub fn mime_precedence ( & self ) -> Vec < Mime > { let mut types = self . 0 . clone ( ) ; // use stable sort so items with equal q-factor and specificity retain listed order types . sort_by ( | a , b | { // sort by q-factor descending b . quality . cmp ( & a . quality ) . then_with ( | | { // use specificity rules on mime types with // same q-factor (eg. text/html > text/* > */*) // subtypes are not comparable if main type is star, so return match ( a . item . type_ ( ) , b . item . type_ ( ) ) { ( mime :: STAR , mime :: STAR ) => return Ordering :: Equal , // a is sorted after b ( mime :: STAR , _ ) => return Ordering :: Greater , // a is sorted before b ( _ , mime :: STAR ) => return Ordering :: Less , _ => { } } // in both these match expressions, the returned ordering appears // inverted because sort is high-to-low ("descending") precedence match ( a . item . subtype ( ) , b . item . subtype ( ) ) { ( mime :: STAR , mime :: STAR ) => Ordering :: Equal , // a is sorted after b ( mime :: STAR , _ ) => Ordering :: Greater , // a is sorted before b ( _ , mime :: STAR ) => Ordering :: Less , _ => Ordering :: Equal , } } ) } ) ; types . into_iter ( ) . map ( | qitem | qitem . item ) . collect ( ) }
Returns a sorted list of mime types from highest to lowest preference, accounting for
[q-factor weighting] and specificity.
Returns a sorted list of mime types from highest to lowest preference accounting for [ q - factor weighting ] and specificity .
&self
&self