Thanks Konrad,
I already have a lot of custom directives, but what I was wondering is if 
there's a way to make them both implicit.
Maybe this is a more general scala question, like: how can I make all the 
parameters of a lambda implicit, because "{ implicit x=> ... }" works while 
"{ implicit (x,y) => ...}" doesn't .

Cheers
G


On Friday, 29 May 2015 19:07:08 UTC+2, Konrad Malawski wrote:
>
> Hi Giovanni,
> Firstly, sorry we don't have docs on this yet, but they are coming soon! ( 
> check this with a higher version number soon 
> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M2/scala/http/custom-directives.html
>  
> <http://www.google.com/url?q=http%3A%2F%2Fdoc.akka.io%2Fdocs%2Fakka-stream-and-http-experimental%2F1.0-M2%2Fscala%2Fhttp%2Fcustom-directives.html&sa=D&sntz=1&usg=AFQjCNFO_CFkEoGTA8VJJ8Voe4yjJRtSRQ>
>  
> )
>
> Both these directives are implemented in terms of the extract directrive,
> by digging a bit through the sources you'll notice the patterns :-)
>
> Something among the lines:
>
> def extractBoth: Directive[(ExecutionContext, FlowMaterializer)] =
>   textract(rc => (rc.executionContext, rc.flowMaterializer))
>
>   extractBoth { (ec, mat) =>
>     // ec.execute()
>     // mat.materialize()
>   }
>
>
> Should do the trick.
> Happy hakking!
>
> On Mon, May 18, 2015 at 8:10 PM, Giovanni Alberto Caporaletti <
> [email protected] <javascript:>> wrote:
>
>> Hi everyone,
>>
>> I often need to have both the materializer and the execution context in 
>> scope in my routes.
>>
>> Is there a more compact way of doing this?
>>
>> extractFlowMaterializer { implicit mat =>
>>   extractExecutionContext { implicit ec =>
>>
>> or
>>
>> extractFlowMaterializer { implicit mat =>
>>   implicit val ec = mat.executionContext
>>
>>
>>
>> I tried something like (extractFlowMaterializer & 
>> extractExecutionContext) { implicit (mat, val) => ... but it doesn't work
>>
>>
>>
>> thanks
>> G
>>
>> -- 
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Cheers,
> Konrad 'ktoso' Malawski
> Akka <http://akka.io/> @ Typesafe <http://typesafe.com/>
>  

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to