pub trait IntoOwnedRange {
    // Required method
    fn into_owned(self) -> BoundRange;
}
Expand description

A convenience trait for converting ranges of borrowed types into a BoundRange.

Examples

let r1: Range<&str> = "s".."e";
let r1: BoundRange = r1.into_owned();

let r2: RangeFrom<&str> = "start"..;
let r2: BoundRange = r2.into_owned();

let r3: RangeInclusive<&str> = "s"..="e";
let r3: BoundRange = r3.into_owned();

let r4: RangeTo<&str> = .."z";
let r4: BoundRange = r4.into_owned();

let k1: Vec<u8> = "start".to_owned().into_bytes();
let k2: Vec<u8> = "end".to_owned().into_bytes();
let r4: BoundRange = (&k1, &k2).into_owned();
let r5: BoundRange = (&k1, None).into_owned();
let r6: BoundRange = (&k1, Some(&k2)).into_owned();

Required Methods§

source

fn into_owned(self) -> BoundRange

Transform a borrowed range of some form into an owned BoundRange.

Implementations on Foreign Types§

source§

impl IntoOwnedRange for RangeFull

source§

impl<T: Into<Key> + Borrow<U>, U: ToOwned<Owned = T> + ?Sized> IntoOwnedRange for (&U, Option<&U>)

source§

impl<T: Into<Key> + Borrow<U>, U: ToOwned<Owned = T> + ?Sized> IntoOwnedRange for (&U, &U)

source§

impl<T: Into<Key> + Borrow<U>, U: ToOwned<Owned = T> + ?Sized> IntoOwnedRange for Range<&U>

source§

impl<T: Into<Key> + Borrow<U>, U: ToOwned<Owned = T> + ?Sized> IntoOwnedRange for RangeFrom<&U>

source§

impl<T: Into<Key> + Borrow<U>, U: ToOwned<Owned = T> + ?Sized> IntoOwnedRange for RangeInclusive<&U>

source§

impl<T: Into<Key> + Borrow<U>, U: ToOwned<Owned = T> + ?Sized> IntoOwnedRange for RangeTo<&U>

source§

impl<T: Into<Key> + Borrow<U>, U: ToOwned<Owned = T> + ?Sized> IntoOwnedRange for RangeToInclusive<&U>

Implementors§