thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Craig <ben.cr...@ni.com>
Subject Re: varargs service declarations?
Date Mon, 26 Jan 2015 14:52:42 GMT
Thrift doesn't have direct support for varargs.  There are some ways you 
can fake it depending on your use case.

If you want a 'printf' like function, your best bet is to do something 
like this...
void printf(1:string format, 2:string vararg_bytes);

Your implementation would then need to pull the data you need out of the 
vararg_bytes string.

If you want to occasionally omit some arguments, then look at optional 
struct members.  For example:
struct Work {
  1: i32 num1 = 0,
  2: i32 num2,
  3: Operation op,
  4: optional string comment,
}
void sendWork(1: Work w)



From:   Victor L <vlyamtsev@gmail.com>
To:     user@thrift.apache.org, 
Date:   01/26/2015 06:05 AM
Subject:        varargs service declarations?



Hi,
How can i implement service with variable number of arguments?
Thks,


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message