📝 Complete documentation of borrow_range

pull/1/head
Shad Amethyst 2 years ago
parent 2766e870c0
commit f38cb4706a
Signed by: amethyst
GPG Key ID: D970C8DD1D6DEE36

@ -352,6 +352,9 @@ impl<T> VecCell<T> {
/// vec.push(3); /// vec.push(3);
/// ///
/// let s = vec.borrow_range(0..2).unwrap(); // Gets elements 0 and 1 /// let s = vec.borrow_range(0..2).unwrap(); // Gets elements 0 and 1
/// assert_eq!(s[0], 1);
/// assert_eq!(s[1], 2);
/// assert!(s.get(2).is_none());
/// ``` /// ```
pub fn borrow_range<'b, R: std::ops::RangeBounds<usize>>(&'b self, range: R) -> Option<VecRef<'b, [T]>> { pub fn borrow_range<'b, R: std::ops::RangeBounds<usize>>(&'b self, range: R) -> Option<VecRef<'b, [T]>> {
VecRef::from_range(self, range) VecRef::from_range(self, range)

Loading…
Cancel
Save