Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
0.13.0
-
None
-
None
Description
Each Struct/Union/Enum generated by thrift-compiler will get two methods: `read_from_in_protocol` and `write_to_out_protocol`.
Firstly, I think these two methods are representing a certain ability of serialization, so they should be put in a trait;
Moreover, if this trait is provided, we can use trait bounding in our user codes, such as
```rust
// pseudo code
fn serialize_struct<T>(s: T) -> Vec<u8> where T: TObject
```
It could also be a pretty useful marker trait as you can see.
The name of `TObject` is only a superficial opinion, but I believe that there are enough reasons to make the trait.
Attachments
Issue Links
- duplicates
-
THRIFT-4100 Extract Rust read/write struct methods into a trait
- Closed
- links to