@@ -57,31 +57,31 @@ use raw::Slice as RawSlice;
57
57
// Extension traits
58
58
//
59
59
60
- /// Extension methods for vectors
60
+ /// Extension methods for immutable slices.
61
61
#[ unstable = "may merge with other traits; region parameter may disappear" ]
62
62
pub trait ImmutableSlice < ' a , T > {
63
- /**
64
- * Returns a slice of self spanning the interval [`start`, `end`).
65
- *
66
- * Fails when the slice (or part of it) is outside the bounds of self,
67
- * or when `start` > `end`.
68
- */
63
+ /// Returns a subslice spanning the interval [`start`, `end`).
64
+ ///
65
+ /// Fails when the end of the new slice lies beyond the end of the
66
+ /// original slice (i.e. when `end > self.len()`) or when `start > end`.
67
+ ///
68
+ /// Slicing with `start` equal to `end` yields an empty slice.
69
69
#[ unstable]
70
70
fn slice ( & self , start : uint , end : uint ) -> & ' a [ T ] ;
71
71
72
- /**
73
- * Returns a slice of self from `start` to the end of the vec.
74
- *
75
- * Fails when `start` points outside the bounds of self.
76
- */
72
+ /// Returns a subslice from `start` to the end of the slice.
73
+ ///
74
+ /// Fails when `start` is strictly greater than the length of the original slice.
75
+ ///
76
+ /// Slicing from `self.len()` yields an empty slice.
77
77
#[ unstable]
78
78
fn slice_from ( & self , start : uint ) -> & ' a [ T ] ;
79
79
80
- /**
81
- * Returns a slice of self from the start of the vec to `end`.
82
- *
83
- * Fails when `end` points outside the bounds of self.
84
- */
80
+ /// Returns a subslice from the start of the slice to `end`.
81
+ ///
82
+ /// Fails when `end` is strictly greater than the length of the original slice.
83
+ ///
84
+ /// Slicing to `0` yields an empty slice.
85
85
#[ unstable]
86
86
fn slice_to ( & self , end : uint ) -> & ' a [ T ] ;
87
87
@@ -486,21 +486,26 @@ pub trait MutableSlice<'a, T> {
486
486
/// Primarily intended for getting a &mut [T] from a [T, ..N].
487
487
fn as_mut_slice ( self ) -> & ' a mut [ T ] ;
488
488
489
- /// Return a slice that points into another slice.
489
+ /// Returns a mutable subslice spanning the interval [`start`, `end`).
490
+ ///
491
+ /// Fails when the end of the new slice lies beyond the end of the
492
+ /// original slice (i.e. when `end > self.len()`) or when `start > end`.
493
+ ///
494
+ /// Slicing with `start` equal to `end` yields an empty slice.
490
495
fn mut_slice ( self , start : uint , end : uint ) -> & ' a mut [ T ] ;
491
496
492
- /**
493
- * Returns a slice of self from `start` to the end of the vec.
494
- *
495
- * Fails when `start` points outside the bounds of self.
496
- */
497
+ /// Returns a mutable subslice from `start` to the end of the slice.
498
+ ///
499
+ /// Fails when `start` is strictly greater than the length of the original slice.
500
+ ///
501
+ /// Slicing from `self.len()` yields an empty slice.
497
502
fn mut_slice_from ( self , start : uint ) -> & ' a mut [ T ] ;
498
503
499
- /**
500
- * Returns a slice of self from the start of the vec to `end`.
501
- *
502
- * Fails when `end` points outside the bounds of self.
503
- */
504
+ /// Returns a mutable subslice from the start of the slice to `end`.
505
+ ///
506
+ /// Fails when `end` is strictly greater than the length of the original slice.
507
+ ///
508
+ /// Slicing to `0` yields an empty slice.
504
509
fn mut_slice_to ( self , end : uint ) -> & ' a mut [ T ] ;
505
510
506
511
/// Returns an iterator that allows modifying each value
0 commit comments