8000 GitHub - evanj/rustgrpcdemo: Rust gRPC example client and server
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

evanj/rustgrpcdemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust gRPC Demo

This is a demonstration program using Rust with gRPC using Tonic. This interoperates with my Go gRPC demo.

Streamclient

This is a gRPC bidirectional streaming example, but also includes a demonstration of Rust Futures and Streams. They are complicated!

References

Tokio Implementation Notes

streamclient has some examples to see how tokio works.

  • Sleep future with 0 delay: poll() gets called twice: first time it returns Pending, then it returns Ready. It could return Ready right away? I assume the implementation is actually waiting until it returns to the tokio runtime before it is Ready, which makes the zero case more similar to the non-zero case, so maybe is better?

  • Stream future with a 0 delay: it gets called three times: the first time it returns Pending, but then something in tonic's implementation has a buffer with data, so it converts it to Ready, which causes it to get polled again. It returns Pending again, because control still has not returned to the tokio runtime. This time it has a zero buffer, so it finally returns to the tokio runtime. It gets polled a third time and returns Ready.

About

Rust gRPC example client and server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0