File tree 6 files changed +29
-10
lines changed
6 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ let package = Package(
21
21
name: " echo-metadata " ,
22
22
platforms: [ . macOS( " 15.0 " ) ] ,
23
23
dependencies: [
24
- // .package(url: "https://github.com/grpc/grpc-swift.git", exact: "2.0.0-rc.1"),
24
+ // .package(url: "https://github.com/grpc/grpc-swift.git", exact: "2.0.0-rc.1"),
25
25
. package ( name: " grpc-swift " , path: " ../../ " ) ,
26
26
. package ( url: " https://github.com/grpc/grpc-swift-protobuf.git " , exact: " 1.0.0-rc.1 " ) ,
27
27
. package ( url: " https://github.com/grpc/grpc-swift-nio-transport.git " , exact: " 1.0.0-rc.1 " ) ,
Original file line number Diff line number Diff line change @@ -21,7 +21,10 @@ struct ClientArguments: ParsableArguments {
21
21
@Option ( help: " The server's listening port " )
22
22
var port : Int = 1234
23
23
24
- @Option ( help: " Message to send to the server. It will also be sent in the request's metadata as the value for `echo-message`. " )
24
+ @Option (
25
+ help:
26
+ " Message to send to the server. It will also be sent in the request's metadata as the value for `echo-message`. "
27
+ )
25
28
var message : String
26
29
}
27
30
Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ struct Collect: AsyncParsableCommand {
43
43
try await writer. write ( . with { $0. text = String ( part) } )
44
44
}
45
45
} onResponse: { response in
46
- print ( " collect ← initial metadata: \( response. metadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) " )
46
+ print (
47
+ " collect ← initial metadata: \( response. metadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) "
48
+ )
47
49
print ( " collect ← message: \( try response. message. text) " )
48
50
print ( " collect ← trailing metadata: \( response. trailingMetadata) " )
49
51
}
Original file line number Diff line number Diff line change @@ -43,14 +43,18 @@ struct Expand: AsyncParsableCommand {
43
43
try await echo. expand ( message, metadata: requestMetadata) { response in
44
44
let responseContents = try response. accepted. get ( )
45
45
46
- print ( " expand ← initial metadata: \( Metadata ( responseContents. metadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) " )
46
+ print (
47
+ " expand ← initial metadata: \( Metadata ( responseContents. metadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) "
48
+ )
47
49
for try await part in responseContents. bodyParts {
48
50
switch part {
49
51
case . message( let message) :
50
52
print ( " expand ← message: \( message. text) " )
51
53
52
54
case . trailingMetadata( let trailingMetadata) :
53
- print ( " expand ← trailing metadata: \( Metadata ( trailingMetadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) " )
55
+ print (
56
+ " expand ← trailing metadata: \( Metadata ( trailingMetadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) "
57
+ )
54
58
}
55
59
}
56
60
}
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ import GRPCCore
19
19
import GRPCNIOTransportHTTP2
20
20
21
21
struct Get : AsyncParsableCommand {
22
- static let configuration = CommandConfiguration ( abstract: " Makes a unary RPC to the echo-metadata server. " )
22
+ static let configuration = CommandConfiguration (
23
+ abstract: " Makes a unary RPC to the echo-metadata server. "
24
+ )
23
25
24
26
@OptionGroup
25
27
var arguments : ClientArguments
@@ -38,9 +40,13 @@ struct Get: AsyncParsableCommand {
38
40
print ( " get → metadata: \( requestMetadata) " )
39
41
print ( " get → message: \( message. text) " )
40
42
try await echo. get ( message, metadata: requestMetadata) { response in
41
- print ( " get ← initial metadata: \( Metadata ( response. metadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) " )
43
+ print (
44
+ " get ← initial metadata: \( Metadata ( response. metadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) "
45
+ )
42
46
print ( " get ← message: \( try response. message. text) " )
43
- print ( " get ← trailing metadata: \( Metadata ( response. trailingMetadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) " )
47
+ print (
48
+ " get ← trailing metadata: \( Metadata ( response. trailingMetadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) "
49
+ )
44
50
}
45
51
}
46
52
}
Original file line number Diff line number Diff line change @@ -45,14 +45,18 @@ struct Update: AsyncParsableCommand {
45
45
} onResponse: { response in
46
46
let responseContents = try response. accepted. get ( )
47
47
48
- print ( " update ← initial metadata: \( Metadata ( responseContents. metadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) " )
48
+ print (
49
+ " update ← initial metadata: \( Metadata ( responseContents. metadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) "
50
+ )
49
51
for try await part in responseContents. bodyParts {
50
52
switch part {
51
53
case . message( let message) :
52
54
print ( " update ← message: \( message. text) " )
53
55
54
56
case . trailingMetadata( let trailingMetadata) :
55
- print ( " update ← trailing metadata: \( Metadata ( trailingMetadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) " )
57
+ print (
58
+ " update ← trailing metadata: \( Metadata ( trailingMetadata. filter ( { $0. key. starts ( with: " echo- " ) } ) ) ) "
59
+ )
56
60
}
57
61
}
58
62
}
You can’t perform that action at this time.
0 commit comments