File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ public enum RedisData {
10
10
case error( RedisError )
11
11
case integer( Int )
12
12
case array( [ RedisData ] )
13
+
14
+ /// Initializes a `bulkString` by converting the provided string input.
15
+ public init ( bulk: String ) {
16
+ self = . bulkString( Data ( bulk. utf8) )
17
+ }
13
18
}
14
19
15
20
extension RedisData : ExpressibleByStringLiteral {
@@ -43,7 +48,8 @@ extension RedisData: ExpressibleByIntegerLiteral {
43
48
// Internal convienence computed properties
44
49
45
50
extension RedisData {
46
- /// Extracts the basic/bulk string as a `String`.
51
+ /// Extracts the simple/bulk string as a `String`.
52
+ /// - Note: This attempts to convert a `bulkString` to a `String` using UTF-8 encoding and may return nil.
47
53
var string : String ? {
48
54
switch self {
49
55
case . simpleString( let string) : return string
You can’t perform that action at this time.
0 commit comments