mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
### Motivation: Users may want to move a non-Sendable value into an EventLoopFuture. This is safe if we take the value as `sending` ### Modifications: Change functions whcih currently require Sendable parameters to instead take the parameter as `sending` where possible. This seems to not break API Some functions take closures whcih return Sendable values, those ones now take closures which return sending values. This has been done as an overload, because a straight replacement seems to break API
37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2021 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
extension EventLoop {
|
|
@inlinable
|
|
@available(*, deprecated, message: "Please don't pass file:line:, there's no point.")
|
|
public func makeFailedFuture<T>(
|
|
_ error: Error,
|
|
file: StaticString = #fileID,
|
|
line: UInt = #line
|
|
) -> EventLoopFuture<T> {
|
|
self.makeFailedFuture(error)
|
|
}
|
|
|
|
@preconcurrency
|
|
@inlinable
|
|
@available(*, deprecated, message: "Please don't pass file:line:, there's no point.")
|
|
public func makeSucceededFuture<Success>(
|
|
_ value: sending Success,
|
|
file: StaticString = #fileID,
|
|
line: UInt = #line
|
|
) -> EventLoopFuture<Success> {
|
|
self.makeSucceededFuture(value)
|
|
}
|
|
}
|