MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / main

Function main

examples/tonic_example/src/client.rs:7–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5
6#[tokio::main]
7async 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}

Callers

nothing calls this directly

Calls 3

get_postsMethod · 0.80
into_innerMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected