1
Fork 0

impl RangeBounds<T> for Range{,From,To,Inclusive,ToInclusive}<&T>

This commit is contained in:
Simon Sapin 2018-03-20 19:46:11 +01:00 committed by Manish Goregaokar
parent 16d3ba1b23
commit 124453e6fe

View file

@ -646,3 +646,63 @@ impl<'a, T: ?Sized + 'a> RangeBounds<T> for (Bound<&'a T>, Bound<&'a T>) {
self.1
}
}
#[unstable(feature = "collections_range",
reason = "might be replaced with `Into<_>` and a type containing two `Bound` values",
issue = "30877")]
impl<'a, T> RangeBounds<T> for RangeFrom<&'a T> {
fn start(&self) -> Bound<&T> {
Included(self.start)
}
fn end(&self) -> Bound<&T> {
Unbounded
}
}
#[unstable(feature = "collections_range",
reason = "might be replaced with `Into<_>` and a type containing two `Bound` values",
issue = "30877")]
impl<'a, T> RangeBounds<T> for RangeTo<&'a T> {
fn start(&self) -> Bound<&T> {
Unbounded
}
fn end(&self) -> Bound<&T> {
Excluded(self.end)
}
}
#[unstable(feature = "collections_range",
reason = "might be replaced with `Into<_>` and a type containing two `Bound` values",
issue = "30877")]
impl<'a, T> RangeBounds<T> for Range<&'a T> {
fn start(&self) -> Bound<&T> {
Included(self.start)
}
fn end(&self) -> Bound<&T> {
Excluded(self.end)
}
}
#[unstable(feature = "collections_range",
reason = "might be replaced with `Into<_>` and a type containing two `Bound` values",
issue = "30877")]
impl<'a, T> RangeBounds<T> for RangeInclusive<&'a T> {
fn start(&self) -> Bound<&T> {
Included(self.start)
}
fn end(&self) -> Bound<&T> {
Included(self.end)
}
}
#[unstable(feature = "collections_range",
reason = "might be replaced with `Into<_>` and a type containing two `Bound` values",
issue = "30877")]
impl<'a, T> RangeBounds<T> for RangeToInclusive<&'a T> {
fn start(&self) -> Bound<&T> {
Unbounded
}
fn end(&self) -> Bound<&T> {
Included(self.end)
}
}