aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-07-16 10:46:41 +0100
committerdiogo464 <[email protected]>2025-07-16 10:46:41 +0100
commitf319d7ab5278a3cfb43d38875d81c28cc2dce1e1 (patch)
treecb161fd990643e267bbc373fb09ccd7b689a23b5 /README.md
Initial commit - extracted urpc from monorepo
Diffstat (limited to 'README.md')
-rw-r--r--README.md64
1 files changed, 64 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6b84471
--- /dev/null
+++ b/README.md
@@ -0,0 +1,64 @@
1# urpc
2
3A minimalistic RPC framework for Rust, designed for simplicity and performance.
4
5## Features
6
7- Async/await support
8- TCP and Unix socket transport
9- Procedural macros for service definitions
10- Serialization with bincode
11- Lightweight and fast
12
13## Example
14
15```rust
16use urpc::*;
17
18#[urpc::service]
19trait Hello {
20 type Error = ();
21
22 async fn hello(name: String) -> String;
23}
24
25struct HelloServer;
26
27impl Hello for HelloServer {
28 async fn hello(&self, _ctx: urpc::Context, name: String) -> Result<String, ()> {
29 Ok(format!("Hello, {}!", name))
30 }
31}
32
33#[tokio::main]
34async fn main() {
35 // Server
36 let listener = urpc::tcp::bind("127.0.0.1:8080").await.unwrap();
37
38 tokio::spawn(async move {
39 urpc::Server::default()
40 .with_listener(listener)
41 .with_service(HelloServer.into_service())
42 .serve()
43 .await
44 });
45
46 // Client
47 let channel = urpc::ClientChannel::new(
48 urpc::tcp::connect("127.0.0.1:8080").await.unwrap()
49 );
50 let client = HelloClient::new(channel);
51
52 let response = client.hello("World".to_string()).await.unwrap();
53 println!("{}", response); // "Hello, World!"
54}
55```
56
57## License
58
59Licensed under either of
60
61- Apache License, Version 2.0
62- MIT License
63
64at your option. \ No newline at end of file