pub struct Preferences<SelectionT>(pub Vec<Preference<SelectionT>>);
Expand description
List of Preference.
Tuple Fields§
§0: Vec<Preference<SelectionT>>
Implementations§
Source§impl<SelectionT> Preferences<SelectionT>
impl<SelectionT> Preferences<SelectionT>
Sourcepub fn best<'own>(
&'own self,
allowances: &'own [SelectionT],
) -> Option<&'own SelectionT>
pub fn best<'own>( &'own self, allowances: &'own [SelectionT], ) -> Option<&'own SelectionT>
Select the most preferred allowance.
If there is a tie, we will go by the order of allowances.
Sourcepub fn best_or_first<'own>(
&'own self,
allowances: &'own [SelectionT],
) -> &'own SelectionT
pub fn best_or_first<'own>( &'own self, allowances: &'own [SelectionT], ) -> &'own SelectionT
Select the most preferred allowance.
If there is a tie, we will go by the order of allowances.
If no best preference can be found we’ll return the first allowance. allowances
must not
be empty!
Trait Implementations§
Source§impl<SelectionT: Clone> Clone for Preferences<SelectionT>
impl<SelectionT: Clone> Clone for Preferences<SelectionT>
Source§fn clone(&self) -> Preferences<SelectionT>
fn clone(&self) -> Preferences<SelectionT>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<SelectionT> Freeze for Preferences<SelectionT>
impl<SelectionT> RefUnwindSafe for Preferences<SelectionT>where
SelectionT: RefUnwindSafe,
impl<SelectionT> Send for Preferences<SelectionT>where
SelectionT: Send,
impl<SelectionT> Sync for Preferences<SelectionT>where
SelectionT: Sync,
impl<SelectionT> Unpin for Preferences<SelectionT>where
SelectionT: Unpin,
impl<SelectionT> UnwindSafe for Preferences<SelectionT>where
SelectionT: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more