Skip to content

Commit 95ce2cd

Browse files
glbrnttMordil
authored andcommitted
Make RedisKey ExpressibleByStringInterpolation
Motivation: `RedisKey` is `ExpressibleByStringLiteral` but not `ExpressibleByStringInterpolation` which is often just as useful. Modifications: - Add `ExpressibleByStringInterpolation` conformance to `RedisKey` Result: Users can create `RedisKey`s using string interpolation
1 parent 4b06ece commit 95ce2cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/RediStack/RedisKey.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
///
1717
/// `RedisKey` is a thin wrapper around `String`, to provide stronger type-safety at compile-time.
1818
///
19-
/// It conforms to `ExpressibleByStringLiteral`, so creating a key is simple:
19+
/// It conforms to `ExpressibleByStringLiteral` and `ExpressibleByStringInterpolation`, so creating
20+
/// a key is simple:
2021
/// ```swift
21-
/// let key: RedisKey = "foo"
22+
/// let key: RedisKey = "foo" // or "\(someVar)"
2223
/// ```
2324
public struct RedisKey:
2425
RESPValueConvertible,
2526
RawRepresentable,
2627
ExpressibleByStringLiteral,
28+
ExpressibleByStringInterpolation,
2729
CustomStringConvertible, CustomDebugStringConvertible,
2830
Comparable, Hashable, Codable
2931
{

0 commit comments

Comments
 (0)