Repository: apple/swift-nio
File: Sources/NIOPosix/RawSocketBootstrap.swift (Swift)

Code before:
    ///
    /// - Parameters:
    ///   - host: The host to bind on.
    ///   - ipProtocol: The IP protocol used in the IP protocol/nextHeader field.
    ///   - channelInitializer: A closure to initialize the channel which must return the handler that is used for negotiating
    ///   the protocol.
    /// - Returns: The protocol negotiation result.   
    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
    @_spi(AsyncChannel)
    public func bind<Handler: NIOProtocolNegotiationHandler>(
        host: String,
        ipProtocol: NIOIPProtocol,
        channelInitializer: @escaping @Sendable (Channel) -> EventLoopFuture<Handler>
    ) async throws -> Handler.NegotiationResult {
        try await self.bind0(
            host: host,
            ipProtocol: ipProtocol,
            channelInitializer: channelInitializer,
            postRegisterTransformation: { handler, eventLoop in
                handler.protocolNegotiationResult.flatMap { result in
                    result.resolve(on: eventLoop)
                }
            }
        )
    }
    /// Connect the `Channel` to `host`.
    /// All packets or errors matching the `ipProtocol` specified are passed to the resulting `Channel`.
    ///
    /// - Parameters:
    ///   - host: The host to connect to.
    ///   - ipProtocol: The IP protocol used in the IP protocol/nextHeader field.
    ///   - channelInitializer: A closure to initialize the channel which must return the handler that is used for negotiating
    ///   the protocol.
    /// - Returns: The protocol negotiation result.
    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
    @_spi(AsyncChannel)
    public func connect<Handler: NIOProtocolNegotiationHandler>(
        host: String,
        ipProtocol: NIOIPProtocol,
        channelInitializer: @escaping @Sendable (Channel) -> EventLoopFuture<Handler>
    ) async throws -> Handler.NegotiationResult {
        try await self.connect0(
            host: host,
            ipProtocol: ipProtocol,
            channelInitializer: channelInitializer,
            postRegisterTransformation: { handler, eventLoop in
                handler.protocolNegotiationResult.flatMap { result in
                    result.resolve(on: eventLoop)
                }
            }
        )

Review comment (suggestion):
```suggestion
    }

    /// Connect the `Channel` to `host`.
```

Code after:
    /// - Parameters:
    ///   - host: The host to bind on.
    ///   - ipProtocol: The IP protocol used in the IP protocol/nextHeader field.
    ///   - channelInitializer: A closure to initialize the channel which must return the handler that is used for negotiating
    ///   the protocol.
    /// - Returns: The protocol negotiation result.   
    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
    @_spi(AsyncChannel)
    public func bind<Handler: NIOProtocolNegotiationHandler>(
        host: String,
        ipProtocol: NIOIPProtocol,
        channelInitializer: @escaping @Sendable (Channel) -> EventLoopFuture<Handler>
    ) async throws -> Handler.NegotiationResult {
        try await self.bind0(
            host: host,
            ipProtocol: ipProtocol,
            channelInitializer: channelInitializer,
            postRegisterTransformation: { handler, eventLoop in
                handler.protocolNegotiationResult.flatMap { result in
                    result.resolve(on: eventLoop)
                }
            }
        )
    }

    /// Connect the `Channel` to `host`.
    /// All packets or errors matching the `ipProtocol` specified are passed to the resulting `Channel`.
    ///
    /// - Parameters:
    ///   - host: The host to connect to.
    ///   - ipProtocol: The IP protocol used in the IP protocol/nextHeader field.
    ///   - channelInitializer: A closure to initialize the channel which must return the handler that is used for negotiating
    ///   the protocol.
    /// - Returns: The protocol negotiation result.
    @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
    @_spi(AsyncChannel)
    public func connect<Handler: NIOProtocolNegotiationHandler>(
        host: String,
        ipProtocol: NIOIPProtocol,
        channelInitializer: @escaping @Sendable (Channel) -> EventLoopFuture<Handler>
    ) async throws -> Handler.NegotiationResult {
        try await self.connect0(
            host: host,
            ipProtocol: ipProtocol,
            channelInitializer: channelInitializer,
            postRegisterTransformation: { handler, eventLoop in
                handler.protocolNegotiationResult.flatMap { result in
                    result.resolve(on: eventLoop)
                }
            }
        )