PROPOSAL.md: sausage-interface crate and #[on_stop]
This commit is contained in:
+10
-3
@@ -516,14 +516,21 @@ Tests:
|
||||
|
||||
## 13. The SDK
|
||||
|
||||
Two crates: `sausage-plugin`, and `sausage-plugin-macros`, which
|
||||
`sausage-plugin` re-exports. A plugin depends only on `sausage-plugin`. The
|
||||
SDK also re-exports `serde` and `schemars` for the macros.
|
||||
Three crates:
|
||||
|
||||
- `sausage-plugin`: the SDK. A plugin depends only on this crate. It
|
||||
re-exports the macros, `serde`, and `schemars`.
|
||||
- `sausage-plugin-macros`: the macros.
|
||||
- `sausage-interface`: the OpenRPC documents, the compatibility check
|
||||
(section 11.2), and the generator of client code. The macros and the host
|
||||
both use it, so `import!` and `/proc/core/plugins/<name>/client.rs` give
|
||||
the same code.
|
||||
|
||||
| Item | Purpose |
|
||||
| --- | --- |
|
||||
| `#[rpc]` | Makes an `impl` an interface. On the main interface: `#[rpc(endpoints(name = Type), grace_seconds = N)]`. |
|
||||
| `#[on_retired]` | Marks the method that answers `rpc.retired`. |
|
||||
| `#[on_stop]` | Marks the stop hook: an optional method that runs at EOF on stdin (section 4.6). |
|
||||
| `#[schema]` | For each type that a method takes or returns: adds the serde and schemars derives, and checks the subset of section 11.2. |
|
||||
| `run(T)` | In `main`: serves the main interface on stdin and stdout. |
|
||||
| `call(method, params)` | An untyped call. Returns a JSON value. |
|
||||
|
||||
Reference in New Issue
Block a user