-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Labels
area/documentationImprovements or additions to documentation.Improvements or additions to documentation.kind/enhancementImprovements to existing feature.Improvements to existing feature.
Description
After SE-0346 lands in Swift 5.7, it’s possible for us to mark Event
and Output
as primary associate types for LambdaHandler
. This can simplify a demo handler from:
@main
struct MyLambda: LambdaHandler {
typealias Event = String
typealias Output = String
init(context: LambdaInitializationContext) async throws {
// setup your resources that you want to reuse for every invocation here.
}
func handle(_ input: String, context: LambdaContext) async throws -> String {
// as an example, respond with the input's reversed
String(input.reversed())
}
}
into
@main
struct MyLambda: LambdaHandler<String, String> {
init(context: LambdaInitializationContext) async throws {
// setup your resources that you want to reuse for every invocation here.
}
func handle(_ input: String, context: LambdaContext) async throws -> String {
// as an example, respond with the input's reversed
String(input.reversed())
}
}
lin72hlin72h
Metadata
Metadata
Assignees
Labels
area/documentationImprovements or additions to documentation.Improvements or additions to documentation.kind/enhancementImprovements to existing feature.Improvements to existing feature.