Skip to content

Commit

Permalink
Initial Sendable Work (#128)
Browse files Browse the repository at this point in the history
* Enable strict concurrency checking in 5.9

* Make some types we need Sendable Sendable

* Add new AsyncRouter that can be Sendable

* Remove AsyncRouter until I can work out how to handle that mess
  • Loading branch information
0xTim authored Nov 6, 2023
1 parent 88077f2 commit 17a7a3f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
35 changes: 35 additions & 0 deletions Package@swift-5.9.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// swift-tools-version:5.9
import PackageDescription

let package = Package(
name: "routing-kit",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
],
products: [
.library(name: "RoutingKit", targets: ["RoutingKit"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.3")
],
targets: [
.target(
name: "RoutingKit",
dependencies: [
.product(name: "Logging", package: "swift-log"),
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
]),
.testTarget(
name: "RoutingKitTests",
dependencies: ["RoutingKit"],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
]
),
]
)
2 changes: 1 addition & 1 deletion Sources/RoutingKit/Parameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Logging
///
/// let postID = parameters.get("post_id")
///
public struct Parameters {
public struct Parameters: Sendable {
/// Internal storage.
private var values: [String: String]
private var catchall: Catchall
Expand Down
2 changes: 1 addition & 1 deletion Sources/RoutingKit/PathComponent.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// A single path component of a `Route`. An array of these components describes
/// a route's path, including which parts are constant and which parts are dynamic.
public enum PathComponent: ExpressibleByStringInterpolation, CustomStringConvertible {
public enum PathComponent: ExpressibleByStringInterpolation, CustomStringConvertible, Sendable {
/// A normal, constant path component.
case constant(String)

Expand Down
4 changes: 2 additions & 2 deletions Sources/RoutingKit/TrieRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Logging
/// See https://en.wikipedia.org/wiki/Trie for more information.
public final class TrieRouter<Output>: Router, CustomStringConvertible {
/// Available `TrieRouter` customization options.
public enum ConfigurationOption {
public enum ConfigurationOption: Sendable {
/// If set, this will cause the router's route matching to be case-insensitive.
/// - note: Case-insensitive routing may be less performant than case-sensitive routing.
case caseInsensitive
Expand All @@ -18,7 +18,7 @@ public final class TrieRouter<Output>: Router, CustomStringConvertible {
public var options: Set<ConfigurationOption>

/// The root node.
private var root: Node
private let root: Node

/// Configured logger.
public let logger: Logger
Expand Down

0 comments on commit 17a7a3f

Please sign in to comment.