()
| 5 | |
| 6 | #[tokio::main] |
| 7 | async fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 8 | let addr = Endpoint::from_static("http://0.0.0.0:50051"); |
| 9 | |
| 10 | /* |
| 11 | Client code is not implemented in completely |
| 12 | as it would just make the code base look too complicated .... |
| 13 | and interface requires a lot of boilerplate code to implement. |
| 14 | |
| 15 | But a basic implementation is given below .... |
| 16 | please refer it to implement other ways to make your code pretty |
| 17 | */ |
| 18 | |
| 19 | let mut client = BlogpostClient::connect(addr).await?; |
| 20 | let request = Request::new(PostPerPage { per_page: 10 }); |
| 21 | let response = client.get_posts(request).await?; |
| 22 | |
| 23 | for post in response.into_inner().post.iter() { |
| 24 | println!("{post:?}"); |
| 25 | } |
| 26 | |
| 27 | Ok(()) |
| 28 | } |
nothing calls this directly
no test coverage detected