why there is no TBase in thrift for dlang?

zhmt via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 27 18:26:18 PST 2015


I am writing code below:
private Cmd deserialCmd(ubyte[] data)
	{
		Cmd ret;
		TMemoryBuffer trans = new TMemoryBuffer(data);
		auto prot = new TCompactProtocol!TMemoryBuffer(trans);
		ret.read(prot);
		return ret;
	}

If I have diffrent Cmd, I have to repeat the code above,

TBase has methods like write(protocol) read(protocol), if it 
exists in thrift for dlang, I could write like this:

private TBase deserialCmd(ubyte[] data,TBase ret)
	{
		TMemoryBuffer trans = new TMemoryBuffer(data);
		auto prot = new TCompactProtocol!TMemoryBuffer(trans);
		ret.read(prot);
		return ret;
	}

But TBase doesnt exists in thrift for dlang, what can i do now?




More information about the Digitalmars-d-learn mailing list