Enum Entry
pub enum Entry<'a, K, V> {
    Occupied(OccupiedEntry<'a, K, V>),
    Vacant(VacantEntry<'a, K, V>),
}Expand description
Entry for an existing key-value pair in an IndexMap
or a vacant location to insert one.
Variants§
Occupied(OccupiedEntry<'a, K, V>)
Existing slot with equivalent key.
Vacant(VacantEntry<'a, K, V>)
Vacant slot (no equivalent key in the map).
Implementations§
§impl<'a, K, V> Entry<'a, K, V>
 
impl<'a, K, V> Entry<'a, K, V>
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V>
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V>
Sets the value of the entry (after inserting if vacant), and returns an OccupiedEntry.
Computes in O(1) time (amortized average).
pub fn or_insert(self, default: V) -> &'a mut V
pub fn or_insert(self, default: V) -> &'a mut V
Inserts the given default value in the entry if it is vacant and returns a mutable reference to it. Otherwise a mutable reference to an already existent value is returned.
Computes in O(1) time (amortized average).
pub fn or_insert_with<F>(self, call: F) -> &'a mut Vwhere
    F: FnOnce() -> V,
pub fn or_insert_with<F>(self, call: F) -> &'a mut Vwhere
    F: FnOnce() -> V,
Inserts the result of the call function in the entry if it is vacant and returns a mutable
reference to it. Otherwise a mutable reference to an already existent value is returned.
Computes in O(1) time (amortized average).
pub fn or_insert_with_key<F>(self, call: F) -> &'a mut V
pub fn or_insert_with_key<F>(self, call: F) -> &'a mut V
Inserts the result of the call function with a reference to the entry’s key if it is
vacant, and returns a mutable reference to the new value. Otherwise a mutable reference to
an already existent value is returned.
Computes in O(1) time (amortized average).
pub fn key(&self) -> &K
pub fn key(&self) -> &K
Gets a reference to the entry’s key, either within the map if occupied, or else the new key that was used to find the entry.
pub fn and_modify<F>(self, f: F) -> Entry<'a, K, V>
pub fn and_modify<F>(self, f: F) -> Entry<'a, K, V>
Modifies the entry if it is occupied.
pub fn or_default(self) -> &'a mut Vwhere
    V: Default,
pub fn or_default(self) -> &'a mut Vwhere
    V: Default,
Inserts a default-constructed value in the entry if it is vacant and returns a mutable reference to it. Otherwise a mutable reference to an already existent value is returned.
Computes in O(1) time (amortized average).
Trait Implementations§
§impl<K, V> MutableEntryKey for Entry<'_, K, V>
Opt-in mutable access to Entry keys.
 
impl<K, V> MutableEntryKey for Entry<'_, K, V>
Opt-in mutable access to Entry keys.
See MutableEntryKey for more information.
Auto Trait Implementations§
impl<'a, K, V> Freeze for Entry<'a, K, V>where
    K: Freeze,
impl<'a, K, V> RefUnwindSafe for Entry<'a, K, V>where
    K: RefUnwindSafe,
    V: RefUnwindSafe,
impl<'a, K, V> Send for Entry<'a, K, V>
impl<'a, K, V> Sync for Entry<'a, K, V>
impl<'a, K, V> Unpin for Entry<'a, K, V>where
    K: Unpin,
impl<'a, K, V> !UnwindSafe for Entry<'a, K, V>
Blanket Implementations§
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
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
§impl<Source, Target> OctetsInto<Target> for Sourcewhere
    Target: OctetsFrom<Source>,
 
impl<Source, Target> OctetsInto<Target> for Sourcewhere
    Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
§fn try_octets_into(
    self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
 
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
§fn octets_into(self) -> Targetwhere
    Self::Error: Into<Infallible>,
 
fn octets_into(self) -> Targetwhere
    Self::Error: Into<Infallible>,
§impl<D> OwoColorize for D
 
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
    C: Color,
 
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
    C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
    C: Color,
 
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
    C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
 
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
 
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
 
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
 
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
 
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
 
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
 
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
 
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
 
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
 
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
 
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
 
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
 
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
 
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
 
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
 
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
 
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
 
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
 
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
 
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
 
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
 
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
 
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
 
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
 
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
    Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more