Details
-
New Feature
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
I propose to add the ability to read async.
Design:
- Declare a new (async) trait `TInputStreamProtocol`
#[async_trait] pub trait TInputStreamProtocol { /// Read the beginning of a Thrift message. async fn read_message_begin(&mut self) -> crate::Result<TMessageIdentifier>; /// Read the end of a Thrift message. async fn read_message_end(&mut self) -> crate::Result<()>; ...
- generate code to target this trait
This would add two dependencies, futures and async_trait.
We could feature-gate them, but the generation would also require a flag (or a different name, e.g. `rs-async`). Alternatively, just add the two dependencies, which are very small.
Note that rust is effectively collored wrt to async, so the compiler needs both implementations, unfortunately. Fortunately, the differences are small and we can probably abstract everything with "bool is_sync = true")
Attachments
Issue Links
- links to