Skip to content

Commit 6c27af2

Browse files
authored
remove dead code (#29)
motivation: less code changes: remove string/codable redundant abstractions for run(handler) and resut type (pre swift 5 leftover)
1 parent a6af55c commit 6c27af2

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

Sources/SwiftAwsLambda/Lambda+Codable.swift

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,14 @@ extension Lambda {
2424
self.run(LambdaClosureWrapper(closure))
2525
}
2626

27-
/// Run a Lambda defined by implementing the `LambdaCodableHandler` protocol, having `In` and `Out` are `Decodable` and `Encodable` respectively.
28-
///
29-
/// - note: This is a blocking operation that will run forever, as it's lifecycle is managed by the AWS Lambda Runtime Engine.
30-
public static func run<Handler>(_ handler: Handler) where Handler: LambdaCodableHandler {
31-
self.run(handler as LambdaHandler)
32-
}
33-
3427
// for testing
3528
internal static func run<In: Decodable, Out: Encodable>(configuration: Configuration = .init(), closure: @escaping LambdaCodableClosure<In, Out>) -> LambdaLifecycleResult {
3629
return self.run(handler: LambdaClosureWrapper(closure), configuration: configuration)
3730
}
38-
39-
// for testing
40-
internal static func run<Handler>(handler: Handler, configuration: Configuration = .init()) -> LambdaLifecycleResult where Handler: LambdaCodableHandler {
41-
return self.run(handler: handler as LambdaHandler, configuration: configuration)
42-
}
4331
}
4432

45-
/// A result type for a Lambda that returns a generic `Out`, having `Out` extend `Encodable`.
46-
public typealias LambdaCodableResult<Out> = Result<Out, Error>
47-
48-
/// A callback for a Lambda that returns a `LambdaCodableResult<Out>` result type, having `Out` extend `Encodable`.
49-
public typealias LambdaCodableCallback<Out> = (LambdaCodableResult<Out>) -> Void
33+
/// A callback for a Lambda that returns a `Result<Out, Error>` result type, having `Out` extend `Encodable`.
34+
public typealias LambdaCodableCallback<Out> = (Result<Out, Error>) -> Void
5035

5136
/// A processing closure for a Lambda that takes an `In` and returns an `Out` via `LambdaCodableCallback<Out>` asynchronously,
5237
/// having `In` and `Out` extending `Decodable` and `Encodable` respectively.

Sources/SwiftAwsLambda/Lambda+String.swift

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,14 @@ extension Lambda {
2121
self.run(LambdaClosureWrapper(closure))
2222
}
2323

24-
/// Run a Lambda defined by implementing the `LambdaStringHandler` protocol.
25-
///
26-
/// - note: This is a blocking operation that will run forever, as it's lifecycle is managed by the AWS Lambda Runtime Engine.
27-
public static func run(_ handler: LambdaStringHandler) {
28-
self.run(handler as LambdaHandler)
29-
}
30-
3124
// for testing
3225
internal static func run(configuration: Configuration = .init(), _ closure: @escaping LambdaStringClosure) -> LambdaLifecycleResult {
3326
return self.run(handler: LambdaClosureWrapper(closure), configuration: configuration)
3427
}
35-
36-
// for testing
37-
internal static func run(handler: LambdaStringHandler, configuration: Configuration = .init()) -> LambdaLifecycleResult {
38-
return self.run(handler: handler as LambdaHandler, configuration: configuration)
39-
}
4028
}
4129

42-
/// A result type for a Lambda that returns a `String`.
43-
public typealias LambdaStringResult = Result<String, Error>
44-
45-
/// A callback for a Lambda that returns a `LambdaStringResult` result type.
46-
public typealias LambdaStringCallback = (LambdaStringResult) -> Void
30+
/// A callback for a Lambda that returns a `Result<String, Error>` result type.
31+
public typealias LambdaStringCallback = (Result<String, Error>) -> Void
4732

4833
/// A processing closure for a Lambda that takes a `String` and returns a `LambdaStringResult` via `LambdaStringCallback` asynchronously.
4934
public typealias LambdaStringClosure = (Lambda.Context, String, LambdaStringCallback) -> Void

0 commit comments

Comments
 (0)