FR
A server has two restful interface (finduserbyid, newuser)
```shell curl 127.1:3000/user/findbyid/1
curl -X POST 127.1:3000/user/new_user \ -H 'Content-Type: application/json' \ -d '{"id":1,"name":"Link"}'
```
```rust use serdederive::Deserialize; use serdederive::Serialize;
use feign::{client, ClientResult};
pub struct User { pub id: i64, pub name: String, }
pub trait UserClient {
#[get(path = "/findbyid/
```rust
async fn main() { let user_client: UserClient = UserClient::new();
match user_client.find_by_id(12).await {
Ok(option) => match option {
Some(user) => println!("user : {}", user.name),
None => println!("none"),
},
Err(err) => panic!("{}", err),
};
match user_client
.new_user(&User {
id: 123,
name: "name".to_owned(),
})
.await
{
Ok(option) => match option {
Some(result) => println!("result : {}", result),
None => println!("none"),
},
Err(err) => panic!("{}", err),
};
}
text
user : hello
result : name
```