[ 
https://issues.apache.org/jira/browse/THRIFT-5339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Allen George resolved THRIFT-5339.
----------------------------------
    Resolution: Duplicate

Relevant, but duplicates THRIFT-4100.

> [Rust] Add `TObject` trait to cover sync read & write methods of 
> Struct/Union/Enum
> ----------------------------------------------------------------------------------
>
>                 Key: THRIFT-5339
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5339
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Rust - Compiler
>    Affects Versions: 0.13.0
>            Reporter: Jason Shui
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> 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
> { s.write_to_out_protocol(protocol); // do other things.. }
> ```
>  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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to