How the implementation of the struct in the D language to ubyte []
or ubyte []
to the struct, please brothers help answer this question, thank you!
If a struct contains the string
or char []
what to do?
For example, such a structure:
struct UserLogin
{
align(1):
ushort ClientId;
int AccectId;
string LoginUid;
string LoginPwd;
}
Attention to my application in the socket!
I don't think there's anything in the standard library to automatically serialize and deserialize structures to byte streams. std.stream
does that for a variety of basic types, but not entire structs. Apache Thrift support is on the way. Among 3rd-party solutions, you can have a look at the Orange serialization library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With