www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - rpc between Tasks of vibe.d

Hi All!

I will try to illustrate by code what exactly I have in mind:

// we have not shared class/struct with some interface.
class FooController
{
...
     int foo1(int a, string b);
     string foo2(Struct1 c);
...
}

// now we want to make a running task with an instance inside

auto controllerTask = runTask((){

   auto controller = new FooController();
   ReceiveCalls!FooController(controller);

});


// and call it from other tasks, like this

int result1 = Call!FooController(controllerTask).foo1(123, "abc");
string result2 = 
Call!FooController(controllerTask).foo2(Struct1(...));


Is there any interface generator for this? Or what can you 
suggest?

Thanks!
Oct 28 2016