@@ -45,10 +45,10 @@ extension IteratorOverOne: IteratorProtocol, Sequence {
45
45
46
46
/// A collection containing a single element.
47
47
///
48
- /// You can use a `CollectionOfOne` instance to efficiently represent a
49
- /// collection with only one element . For example, you can add a single element
50
- /// to an array by using a `CollectionOfOne` instance with the concatenation
51
- /// operator (`+`):
48
+ /// You can use a `CollectionOfOne` instance when you need to efficiently
49
+ /// represent a single value as a collection . For example, you can add a
50
+ /// single element to an array by using a `CollectionOfOne` instance with the
51
+ /// concatenation operator (`+`):
52
52
///
53
53
/// let a = [1, 2, 3, 4]
54
54
/// let toAdd = 100
@@ -59,7 +59,9 @@ public struct CollectionOfOne<Element> {
59
59
@usableFromInline // FIXME(sil-serialize-all)
60
60
internal var _element : Element
61
61
62
- /// Creates an instance containing just `element`.
62
+ /// Creates an instance containing just the given element.
63
+ ///
64
+ /// - Parameter element: The element to store in the collection.
63
65
@inlinable // FIXME(sil-serialize-all)
64
66
public init ( _ element: Element ) {
65
67
self . _element = element
@@ -90,8 +92,7 @@ extension CollectionOfOne: RandomAccessCollection, MutableCollection {
90
92
91
93
/// Returns the position immediately after the given index.
92
94
///
93
- /// - Parameter i: A valid index of the collection. `i` must be less than
94
- /// `endIndex`.
95
+ /// - Parameter i: A valid index of the collection. `i` must be `0`.
95
96
/// - Returns: The index value immediately after `i`.
96
97
@inlinable // FIXME(sil-serialize-all)
97
98
public func index( after i: Int ) -> Int {
@@ -101,8 +102,7 @@ extension CollectionOfOne: RandomAccessCollection, MutableCollection {
101
102
102
103
/// Returns the position immediately before the given index.
103
104
///
104
- /// - Parameter i: A valid index of the collection. `i` must be greater than
105
- /// `startIndex`.
105
+ /// - Parameter i: A valid index of the collection. `i` must be `1`.
106
106
/// - Returns: The index value immediately before `i`.
107
107
@inlinable // FIXME(sil-serialize-all)
108
108
public func index( before i: Int ) -> Int {
@@ -118,9 +118,10 @@ extension CollectionOfOne: RandomAccessCollection, MutableCollection {
118
118
return IteratorOverOne ( _elements: _element)
119
119
}
120
120
121
- /// Accesses the element at ` position` .
121
+ /// Accesses the element at the specified position.
122
122
///
123
- /// The only valid position in a `CollectionOfOne` instance is `0`.
123
+ /// - Parameter position: The position of the element to access. The only
124
+ /// valid position in a `CollectionOfOne` instance is `0`.
124
125
@inlinable // FIXME(sil-serialize-all)
125
126
public subscript( position: Int ) -> Element {
126
127
get {
0 commit comments