Skip to content

Commit 5a53926

Browse files
committed
Update wording in README
1 parent faad004 commit 5a53926

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Methods on services are defined using callbacks. While this is fine for simple s
5151
It offers a higher-level abstraction over the underlying protocol, making it easier to use and understand by providing a cleaner more structured way to define services by leveraging Rust's powerful macro system, something similar to [rocket.rs](https://rocket.rs/) but for SOME/IP.
5252

5353
# Example
54-
Here's a simple example of defining a service and method using smip:
54+
Let's look at a simple "Hello World" example using smip.
5555

5656
```rust
5757
use smip::{Runtime, RuntimeConfig, Service};
@@ -63,18 +63,13 @@ struct MyService {
6363

6464
#[smip::methods_impl]
6565
impl MyService {
66-
// Method that adds whatever value it receives to x
67-
// Expects u32 in request
68-
// Returns u32 in response
66+
6967
#[smip_method(id = 1)]
7068
fn add(&mut self, value: u32) -> u32 {
7169
self.x += value;
7270
self.x
7371
}
74-
75-
// Method that sends a string
76-
// Expects nothing in request
77-
// Returns String in response
72+
7873
#[smip_method(id = 2)]
7974
fn hello(&self) -> String {
8075
"Hello World!".to_string()
@@ -98,6 +93,8 @@ A service is represented by a struct, `MyService` in this case, with a `service`
9893
SOME/IP methods are just rust methods with a special `smip_method` attribute to indicate its id. Whatever you pass as an argument to your method is parsed automatically from the payload, and whatever you return from it serialized into a response and sent back.
9994
All of these need to be in a special impl block marked with a `methods_impl` attribute for the framework to recognize them.
10095

96+
There are two methods
97+
10198
A `Runtime` needs to be created using a `RuntimeConfig` which which take care of creating and running all of your services.
10299

103100
After adding all your services to the `Runtime`, call `runtime.run()` to start all the services.

0 commit comments

Comments
 (0)