Skip to content

Commit b3fbee6

Browse files
authored
Add SendableMetatype conformance (#518)
Add SendableMetatype conformance to StreamingLambdaHandler ### Motivation: Swift 6.2 introduced new protocol SendableMetatype for Types that are Sendable ### Modifications: Added `_Lambda_SendableMetatype` typealias for SendableMetatype in Swift 6.2 and ```swift public protocol StreamingLambdaHandler: _Lambda_SendableMetatype { ``` ### Result: No more compile warnings
1 parent a616996 commit b3fbee6

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Sources/AWSLambdaRuntime/LambdaHandlers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import NIOCore
2020
/// Background work can also be executed after returning the response. After closing the response stream by calling
2121
/// ``LambdaResponseStreamWriter/finish()`` or ``LambdaResponseStreamWriter/writeAndFinish(_:)``,
2222
/// the ``handle(_:responseWriter:context:)`` function is free to execute any background work.
23-
public protocol StreamingLambdaHandler {
23+
public protocol StreamingLambdaHandler: _Lambda_SendableMetatype {
2424
/// The handler function -- implement the business logic of the Lambda function here.
2525
/// - Parameters:
2626
/// - event: The invocation's input data.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the SwiftAWSLambdaRuntime open source project
4+
//
5+
// Copyright (c) 2025 Apple Inc. and the SwiftAWSLambdaRuntime project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of SwiftAWSLambdaRuntime project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
#if compiler(>=6.2)
16+
@_documentation(visibility: internal)
17+
public typealias _Lambda_SendableMetatype = SendableMetatype
18+
#else
19+
@_documentation(visibility: internal)
20+
public typealias _Lambda_SendableMetatype = Any
21+
#endif

0 commit comments

Comments
 (0)