Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
use std::ops::{Range, RangeFrom, RangeTo};
pub trait RangeExt<T> {
fn before(&self) -> RangeTo<T>;
fn after(&self) -> RangeFrom<T>;
impl<T: Copy> RangeExt<T> for Range<T> {
fn before(&self) -> RangeTo<T> {
fn after(&self) -> RangeFrom<T> {
mod tests {
use super::RangeExt;
fn range_ext() {
assert_eq!(..3, (3..5).before());
assert_eq!(5.., (3..5).after());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.