@@ -266,22 +266,29 @@ object Completions {
266266 case Response (f : Future [HttpResponse ])
267267 case Status (code : Future [StatusCode ])
268268 }
269+ object CompletionArg {
270+
271+ // conversions defining the possible arguments to pass to `complete`
272+ // these always come with CompletionArg
273+ // They can be invoked explicitly, e.g.
274+ //
275+ // CompletionArg.from(statusCode)
276+
277+ implied fromString for Conversion [String , CompletionArg ] {
278+ def apply (s : String ) = CompletionArg .Error (s)
279+ }
280+ implied fromFuture for Conversion [Future [HttpResponse ], CompletionArg ] {
281+ def apply (f : Future [HttpResponse ]) = CompletionArg .Response (f)
282+ }
283+ implied fromStatusCode for Conversion [Future [StatusCode ], CompletionArg ] {
284+ def apply (code : Future [StatusCode ]) = CompletionArg .Status (code)
285+ }
286+ }
269287 import CompletionArg ._
270288
271289 def complete [T ](arg : CompletionArg ) = arg match {
272290 case Error (s) => ???
273291 case Response (f) => ???
274292 case Status (code) => ???
275293 }
276-
277- // conversions defining the possible arguments to pass to `complete`
278- implied stringArg for Conversion [String , CompletionArg ] {
279- def apply (s : String ) = CompletionArg .Error (s)
280- }
281- implied responseArg for Conversion [Future [HttpResponse ], CompletionArg ] {
282- def apply (f : Future [HttpResponse ]) = CompletionArg .Response (f)
283- }
284- implied statusArg for Conversion [Future [StatusCode ], CompletionArg ] {
285- def apply (code : Future [StatusCode ]) = CompletionArg .Status (code)
286- }
287294}
0 commit comments