Skip to content

Commit a408273

Browse files
authored
Fix several minor typos in comments found in various files (#2455)
1 parent 2ab7332 commit a408273

File tree

7 files changed

+36
-34
lines changed

7 files changed

+36
-34
lines changed

Sources/NIOCore/ByteBuffer-int.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ extension ByteBuffer {
7474
/// - parameters:
7575
/// - integer: The integer to serialize.
7676
/// - endianness: The endianness to use, defaults to big endian.
77+
/// - as: the desired `FixedWidthInteger` type (optional parameter)
7778
/// - returns: The number of bytes written.
7879
@discardableResult
7980
@inlinable
@@ -91,6 +92,7 @@ extension ByteBuffer {
9192
/// - integer: The integer to serialize.
9293
/// - index: The index of the first byte to write.
9394
/// - endianness: The endianness to use, defaults to big endian.
95+
/// - as: the desired `FixedWidthInteger` type (optional parameter)
9496
/// - returns: The number of bytes written.
9597
@discardableResult
9698
@inlinable

Sources/NIOCore/ChannelHandler.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/// Base protocol for handlers that handle I/O events or intercept an I/O operation.
1616
///
1717
/// All methods are called from within the `EventLoop` that is assigned to the `Channel` itself.
18-
//
18+
///
1919
/// You should _never_ implement this protocol directly. Please implement one of its sub-protocols.
2020
public protocol ChannelHandler: AnyObject {
2121
/// Called when this `ChannelHandler` is added to the `ChannelPipeline`.
@@ -33,7 +33,7 @@ public protocol ChannelHandler: AnyObject {
3333

3434
/// Untyped `ChannelHandler` which handles outbound I/O events or intercept an outbound I/O operation.
3535
///
36-
/// Despite the fact that `write` is one of the methods on this `protocol`, you should avoid assuming that "outbound" events are to do with
36+
/// Despite the fact that `write` is one of the methods on this protocol, you should avoid assuming that "outbound" events are to do with
3737
/// writing to channel sources. Instead, "outbound" events are events that are passed *to* the channel source (e.g. a socket): that is, things you tell
3838
/// the channel source to do. That includes `write` ("write this data to the channel source"), but it also includes `read` ("please begin attempting to read from
3939
/// the channel source") and `bind` ("please bind the following address"), which have nothing to do with sending data.
@@ -104,7 +104,7 @@ public protocol _ChannelOutboundHandler: ChannelHandler {
104104
/// - context: The `ChannelHandlerContext` which this `ChannelHandler` belongs to.
105105
func read(context: ChannelHandlerContext)
106106

107-
/// Called to request that the `Channel` close itself down`.
107+
/// Called to request that the `Channel` close itself down.
108108
///
109109
/// This should call `context.close` to forward the operation to the next `_ChannelOutboundHandler` in the `ChannelPipeline` or
110110
/// complete the `EventLoopPromise` to let the caller know that the operation completed.
@@ -129,7 +129,7 @@ public protocol _ChannelOutboundHandler: ChannelHandler {
129129

130130
/// Untyped `ChannelHandler` which handles inbound I/O events.
131131
///
132-
/// Despite the fact that `channelRead` is one of the methods on this `protocol`, you should avoid assuming that "inbound" events are to do with
132+
/// Despite the fact that `channelRead` is one of the methods on this protocol, you should avoid assuming that "inbound" events are to do with
133133
/// reading from channel sources. Instead, "inbound" events are events that originate *from* the channel source (e.g. the socket): that is, events that the
134134
/// channel source tells you about. This includes things like `channelRead` ("there is some data to read"), but it also includes things like
135135
/// `channelWritabilityChanged` ("this source is no longer marked writable").
@@ -161,7 +161,7 @@ public protocol _ChannelInboundHandler: ChannelHandler {
161161
/// - context: The `ChannelHandlerContext` which this `ChannelHandler` belongs to.
162162
func channelActive(context: ChannelHandlerContext)
163163

164-
/// Called when the `Channel` has become inactive and is no longer able to send and receive data`.
164+
/// Called when the `Channel` has become inactive and is no longer able to send and receive data.
165165
///
166166
/// This should call `context.fireChannelInactive` to forward the operation to the next `_ChannelInboundHandler` in the `ChannelPipeline` if you want to allow the next handler to also handle the event.
167167
///
@@ -215,7 +215,7 @@ public protocol _ChannelInboundHandler: ChannelHandler {
215215
func errorCaught(context: ChannelHandlerContext, error: Error)
216216
}
217217

218-
// Default implementations for the ChannelHandler protocol
218+
// Default implementations for the ChannelHandler protocol
219219
extension ChannelHandler {
220220

221221
/// Do nothing by default.
@@ -312,7 +312,7 @@ extension _ChannelInboundHandler {
312312
/// A `RemovableChannelHandler` is a `ChannelHandler` that can be dynamically removed from a `ChannelPipeline` whilst
313313
/// the `Channel` is operating normally.
314314
/// A `RemovableChannelHandler` is required to remove itself from the `ChannelPipeline` (using
315-
/// `ChannelHandlerContext.removeHandler`) as soon as possible.
315+
/// `ChannelHandlerContext.leavePipeline`) as soon as possible.
316316
///
317317
/// - note: When a `Channel` gets torn down, every `ChannelHandler` in the `Channel`'s `ChannelPipeline` will be
318318
/// removed from the `ChannelPipeline`. Those removals however happen synchronously and are not going through
@@ -321,23 +321,23 @@ public protocol RemovableChannelHandler: ChannelHandler {
321321
/// Ask the receiving `RemovableChannelHandler` to remove itself from the `ChannelPipeline` as soon as possible.
322322
/// The receiving `RemovableChannelHandler` may elect to remove itself sometime after this method call, rather than
323323
/// immediately, but if it does so it must take the necessary precautions to handle events arriving between the
324-
/// invocation of this method and the call to `ChannelHandlerContext.removeHandler` that triggers the actual
324+
/// invocation of this method and the call to `ChannelHandlerContext.leavePipeline` that triggers the actual
325325
/// removal.
326326
///
327327
/// - note: Like the other `ChannelHandler` methods, this method should not be invoked by the user directly. To
328-
/// remove a `RemovableChannelHandler` from the `ChannelPipeline`, use `ChannelPipeline.remove`.
328+
/// remove a `RemovableChannelHandler` from the `ChannelPipeline`, use `ChannelPipeline.removeHandler`.
329329
///
330330
/// - parameters:
331331
/// - context: The `ChannelHandlerContext` of the `RemovableChannelHandler` to be removed from the `ChannelPipeline`.
332-
/// - removalToken: The removal token to hand to `ChannelHandlerContext.removeHandler` to trigger the actual
332+
/// - removalToken: The removal token to hand to `ChannelHandlerContext.leavePipeline` to trigger the actual
333333
/// removal from the `ChannelPipeline`.
334334
func removeHandler(context: ChannelHandlerContext, removalToken: ChannelHandlerContext.RemovalToken)
335335
}
336336

337337
extension RemovableChannelHandler {
338-
// Implements the default behaviour which is to synchronously remove the handler from the pipeline. Thanks to this,
339-
// stateless `ChannelHandler`s can just use `RemovableChannelHandler` as a marker-protocol and declare themselves
340-
// as removable without writing any extra code.
338+
/// Implements the default behaviour which is to synchronously remove the handler from the pipeline. Thanks to this,
339+
/// stateless `ChannelHandler`s can just use `RemovableChannelHandler` as a marker-protocol and declare themselves
340+
/// as removable without writing any extra code.
341341
public func removeHandler(context: ChannelHandlerContext, removalToken: ChannelHandlerContext.RemovalToken) {
342342
precondition(context.handler === self)
343343
context.leavePipeline(removalToken: removalToken)

Sources/NIOCore/ChannelOption.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ extension ChannelOptions {
191191
public init() { }
192192
}
193193

194-
/// ``DatagramSegmentSize`` controls the 'UDP_SEGMENT' socket option (sometimes reffered to as 'GSO') which allows for
194+
/// ``DatagramSegmentSize`` controls the `UDP_SEGMENT` socket option (sometimes reffered to as 'GSO') which allows for
195195
/// large writes to be sent via `sendmsg` and `sendmmsg` and segmented into separate datagrams by the kernel (or in some cases, the NIC).
196196
/// The size of segments the large write is split into is controlled by the value of this option (note that writes do not need to be a
197197
/// multiple of this option).
@@ -204,7 +204,7 @@ extension ChannelOptions {
204204
public init() { }
205205
}
206206

207-
/// ``DatagramReceiveOffload`` sets the 'UDP_GRO' socket option which allows for datagrams to be accumulated
207+
/// ``DatagramReceiveOffload`` sets the `UDP_GRO` socket option which allows for datagrams to be accumulated
208208
/// by the kernel (or in some cases, the NIC) and reduces traversals in the kernel's networking layer.
209209
///
210210
/// This option is currently only supported on Linux (5.10 and newer). Support can be checked

Sources/NIOCore/ChannelPipeline.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
/// - 1 and 2 don't implement `ChannelOutboundHandler`, and therefore the actual evaluation order of a outbound event will be: 5, 4, and 3.
110110
/// - If 5 implements both `ChannelInboundHandler` and `ChannelOutboundHandler`, the evaluation order of an inbound and a outbound event could be 125 and 543 respectively.
111111
///
112-
/// Note: Handlers may choose not to propagate messages down the pipeline immediately. For example a handler may need to wait
112+
/// - Note: Handlers may choose not to propagate messages down the pipeline immediately. For example a handler may need to wait
113113
/// for additional data before sending a protocol event to the next handler in the pipeline. Due to this you can't assume that later handlers
114114
/// in the pipeline will receive the same number of events as were sent, or that events of different types will arrive in the same order.
115115
/// For example - a user event could overtake a data event if a handler is aggregating data events before propagating but immediately

Sources/NIOCore/Codec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ extension ByteToMessageDecoderError {
107107
///
108108
/// ### Implementers Notes
109109
///
110-
/// /// `ByteToMessageHandler` will turn your `ByteToMessageDecoder` into a `ChannelInboundHandler`. `ByteToMessageHandler`
110+
/// `ByteToMessageHandler` will turn your `ByteToMessageDecoder` into a `ChannelInboundHandler`. `ByteToMessageHandler`
111111
/// also solves a couple of tricky issues for you. Most importantly, in a `ByteToMessageDecoder` you do _not_ need to
112112
/// worry about re-entrancy. Your code owns the passed-in `ByteBuffer` for the duration of the `decode`/`decodeLast` call and
113113
/// can modify it at will.

Sources/NIOCore/NIOAny.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public struct NIOAny {
8080

8181
/// Try unwrapping the wrapped message as `ByteBuffer`.
8282
///
83-
/// returns: The wrapped `ByteBuffer` or `nil` if the wrapped message is not a `ByteBuffer`.
83+
/// - returns: The wrapped `ByteBuffer` or `nil` if the wrapped message is not a `ByteBuffer`.
8484
@inlinable
8585
func tryAsByteBuffer() -> ByteBuffer? {
8686
if case .ioData(.byteBuffer(let bb)) = self._storage {
@@ -92,7 +92,7 @@ public struct NIOAny {
9292

9393
/// Force unwrapping the wrapped message as `ByteBuffer`.
9494
///
95-
/// returns: The wrapped `ByteBuffer` or crash if the wrapped message is not a `ByteBuffer`.
95+
/// - returns: The wrapped `ByteBuffer` or crash if the wrapped message is not a `ByteBuffer`.
9696
@inlinable
9797
func forceAsByteBuffer() -> ByteBuffer {
9898
if let v = tryAsByteBuffer() {
@@ -104,7 +104,7 @@ public struct NIOAny {
104104

105105
/// Try unwrapping the wrapped message as `IOData`.
106106
///
107-
/// returns: The wrapped `IOData` or `nil` if the wrapped message is not a `IOData`.
107+
/// - returns: The wrapped `IOData` or `nil` if the wrapped message is not a `IOData`.
108108
@inlinable
109109
func tryAsIOData() -> IOData? {
110110
if case .ioData(let data) = self._storage {
@@ -116,7 +116,7 @@ public struct NIOAny {
116116

117117
/// Force unwrapping the wrapped message as `IOData`.
118118
///
119-
/// returns: The wrapped `IOData` or crash if the wrapped message is not a `IOData`.
119+
/// - returns: The wrapped `IOData` or crash if the wrapped message is not a `IOData`.
120120
@inlinable
121121
func forceAsIOData() -> IOData {
122122
if let v = tryAsIOData() {
@@ -128,7 +128,7 @@ public struct NIOAny {
128128

129129
/// Try unwrapping the wrapped message as `FileRegion`.
130130
///
131-
/// returns: The wrapped `FileRegion` or `nil` if the wrapped message is not a `FileRegion`.
131+
/// - returns: The wrapped `FileRegion` or `nil` if the wrapped message is not a `FileRegion`.
132132
@inlinable
133133
func tryAsFileRegion() -> FileRegion? {
134134
if case .ioData(.fileRegion(let f)) = self._storage {
@@ -140,7 +140,7 @@ public struct NIOAny {
140140

141141
/// Force unwrapping the wrapped message as `FileRegion`.
142142
///
143-
/// returns: The wrapped `FileRegion` or crash if the wrapped message is not a `FileRegion`.
143+
/// - returns: The wrapped `FileRegion` or crash if the wrapped message is not a `FileRegion`.
144144
@inlinable
145145
func forceAsFileRegion() -> FileRegion {
146146
if let v = tryAsFileRegion() {
@@ -152,7 +152,7 @@ public struct NIOAny {
152152

153153
/// Try unwrapping the wrapped message as `AddressedEnvelope<ByteBuffer>`.
154154
///
155-
/// returns: The wrapped `AddressedEnvelope<ByteBuffer>` or `nil` if the wrapped message is not an `AddressedEnvelope<ByteBuffer>`.
155+
/// - returns: The wrapped `AddressedEnvelope<ByteBuffer>` or `nil` if the wrapped message is not an `AddressedEnvelope<ByteBuffer>`.
156156
@inlinable
157157
func tryAsByteEnvelope() -> AddressedEnvelope<ByteBuffer>? {
158158
if case .bufferEnvelope(let e) = self._storage {
@@ -164,7 +164,7 @@ public struct NIOAny {
164164

165165
/// Force unwrapping the wrapped message as `AddressedEnvelope<ByteBuffer>`.
166166
///
167-
/// returns: The wrapped `AddressedEnvelope<ByteBuffer>` or crash if the wrapped message is not an `AddressedEnvelope<ByteBuffer>`.
167+
/// - returns: The wrapped `AddressedEnvelope<ByteBuffer>` or crash if the wrapped message is not an `AddressedEnvelope<ByteBuffer>`.
168168
@inlinable
169169
func forceAsByteEnvelope() -> AddressedEnvelope<ByteBuffer> {
170170
if let e = tryAsByteEnvelope() {
@@ -176,7 +176,7 @@ public struct NIOAny {
176176

177177
/// Try unwrapping the wrapped message as `T`.
178178
///
179-
/// returns: The wrapped `T` or `nil` if the wrapped message is not a `T`.
179+
/// - returns: The wrapped `T` or `nil` if the wrapped message is not a `T`.
180180
@inlinable
181181
func tryAsOther<T>(type: T.Type = T.self) -> T? {
182182
switch self._storage {
@@ -191,7 +191,7 @@ public struct NIOAny {
191191

192192
/// Force unwrapping the wrapped message as `T`.
193193
///
194-
/// returns: The wrapped `T` or crash if the wrapped message is not a `T`.
194+
/// - returns: The wrapped `T` or crash if the wrapped message is not a `T`.
195195
@inlinable
196196
func forceAsOther<T>(type: T.Type = T.self) -> T {
197197
if let v = tryAsOther(type: type) {
@@ -203,7 +203,7 @@ public struct NIOAny {
203203

204204
/// Force unwrapping the wrapped message as `T`.
205205
///
206-
/// returns: The wrapped `T` or crash if the wrapped message is not a `T`.
206+
/// - returns: The wrapped `T` or crash if the wrapped message is not a `T`.
207207
@inlinable
208208
func forceAs<T>(type: T.Type = T.self) -> T {
209209
switch T.self {
@@ -222,7 +222,7 @@ public struct NIOAny {
222222

223223
/// Try unwrapping the wrapped message as `T`.
224224
///
225-
/// returns: The wrapped `T` or `nil` if the wrapped message is not a `T`.
225+
/// - returns: The wrapped `T` or `nil` if the wrapped message is not a `T`.
226226
@inlinable
227227
func tryAs<T>(type: T.Type = T.self) -> T? {
228228
switch T.self {
@@ -241,7 +241,7 @@ public struct NIOAny {
241241

242242
/// Unwrap the wrapped message.
243243
///
244-
/// returns: The wrapped message.
244+
/// - returns: The wrapped message.
245245
@inlinable
246246
func asAny() -> Any {
247247
switch self._storage {

Sources/NIOCore/Utilities.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,24 +210,24 @@ public enum System {
210210

211211
extension System {
212212
#if os(Linux)
213-
/// Returns true if the platform supports 'UDP_SEGMENT' (GSO).
213+
/// Returns true if the platform supports `UDP_SEGMENT` (GSO).
214214
///
215215
/// The option can be enabled by setting the ``ChannelOptions/Types/DatagramSegmentSize`` channel option.
216216
public static let supportsUDPSegmentationOffload: Bool = CNIOLinux_supports_udp_segment()
217217
#else
218-
/// Returns true if the platform supports 'UDP_SEGMENT' (GSO).
218+
/// Returns true if the platform supports `UDP_SEGMENT` (GSO).
219219
///
220220
/// The option can be enabled by setting the ``ChannelOptions/Types/DatagramSegmentSize`` channel option.
221221
public static let supportsUDPSegmentationOffload: Bool = false
222222
#endif
223223

224224
#if os(Linux)
225-
/// Returns true if the platform supports 'UDP_GRO'.
225+
/// Returns true if the platform supports `UDP_GRO`.
226226
///
227227
/// The option can be enabled by setting the ``ChannelOptions/Types/DatagramReceiveOffload`` channel option.
228228
public static let supportsUDPReceiveOffload: Bool = CNIOLinux_supports_udp_gro()
229229
#else
230-
/// Returns true if the platform supports 'UDP_GRO'.
230+
/// Returns true if the platform supports `UDP_GRO`.
231231
///
232232
/// The option can be enabled by setting the ``ChannelOptions/Types/DatagramReceiveOffload`` channel option.
233233
public static let supportsUDPReceiveOffload: Bool = false

0 commit comments

Comments
 (0)