From 10fce0592ae965ad1299366873dc704d475134ac Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 14 Feb 2021 01:57:09 +0900 Subject: [PATCH] impl Deref for set::Entry --- crossbeam-skiplist/src/set.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crossbeam-skiplist/src/set.rs b/crossbeam-skiplist/src/set.rs index b007d2a88..7ffe477ea 100644 --- a/crossbeam-skiplist/src/set.rs +++ b/crossbeam-skiplist/src/set.rs @@ -3,6 +3,7 @@ use std::borrow::Borrow; use std::fmt; use std::iter::FromIterator; +use std::ops::Deref; use std::ops::{Bound, RangeBounds}; use crate::map; @@ -281,6 +282,14 @@ where } } +impl Deref for Entry<'_, T> { + type Target = T; + + fn deref(&self) -> &Self::Target { + self.value() + } +} + /// An owning iterator over the entries of a `SkipSet`. pub struct IntoIter { inner: map::IntoIter,