|
| 1 | +# Eclipse uProtocol Rust library |
| 2 | + |
| 3 | +This is the [uProtocol v1.6.0-alpha.2 Language Library](https://github.com/eclipse-uprotocol/uprotocol-spec/blob/v1.6.0-alpha.2/languages.adoc) for the Rust programming language. |
| 4 | + |
| 5 | +The crate can be used to |
| 6 | + |
| 7 | +* implement uEntities that communicate with each other using the uProtocol [Communication Layer API](https://github.com/eclipse-uprotocol/up-spec/blob/v1.6.0-alpha.2/up-l2/api.adoc) over one of the supported transport protocols. |
| 8 | +* implement support for an additional transport protocol by means of implementing the [Transport Layer API](https://github.com/eclipse-uprotocol/up-spec/blob/v1.6.0-alpha.2/up-l1/README.adoc). |
| 9 | + |
| 10 | +## Building |
| 11 | +<!-- |
| 12 | +`uman~up-language-building~1` |
| 13 | +Covers: |
| 14 | +- req~up-language-documentation~1 |
| 15 | +--> |
| 16 | + |
| 17 | +The crate can be built using the [Cargo package manager](https://doc.rust-lang.org/cargo/) from the root folder: |
| 18 | +<!-- |
| 19 | +`impl~use-cargo-build-system~1` |
| 20 | +Covers: |
| 21 | +- req~up-language-build-sys~1 |
| 22 | +- req~up-language-build-deps~1 |
| 23 | +--> |
| 24 | + |
| 25 | +```sh |
| 26 | +cargo build |
| 27 | +``` |
| 28 | + |
| 29 | +The build requires an active connection to the internet because it needs to download and compile [uProtocol protobuf files](https://github.com/eclipse-uprotocol/up-spec/tree/v1.6.0-alpha.2/up-core-api) which define many of the core types used throughout the library. |
| 30 | + |
| 31 | +The crate has some (optional) _features_ as documented in [lib.rs](src/lib.rs). |
| 32 | + |
| 33 | +VSCode can be instructed to build all features automatically by means of putting the following into `./vscode/settings.json`: |
| 34 | + |
| 35 | +```json |
| 36 | +{ |
| 37 | + "rust-analyzer.cargo.features": "all" |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +### Generating API Documentation |
| 42 | + |
| 43 | +The API documentation can be generated using |
| 44 | + |
| 45 | +```sh |
| 46 | +cargo doc --no-deps --all-features --open |
| 47 | +``` |
| 48 | + |
| 49 | +## Using the Crate |
| 50 | +<!-- |
| 51 | +`uman~up-language-using~1` |
| 52 | +Covers: |
| 53 | +- req~up-language-documentation~ |
| 54 | +--> |
| 55 | +The crate needs to be added to the `[dependencies]` section of the `Cargo.toml` file: |
| 56 | + |
| 57 | +```toml |
| 58 | +[dependencies] |
| 59 | +up-rust = { version = "0.1" } |
| 60 | +``` |
| 61 | + |
| 62 | +Most developers will want to use the Communication Level API and its default implementation |
| 63 | +which are provided by `communication` module. |
| 64 | + |
| 65 | +## License |
| 66 | + |
| 67 | +The crate is published under the terms of the [Apache License 2.0](LICENSE). |
| 68 | + |
| 69 | +## Contributing |
| 70 | + |
| 71 | +Contributions are more than welcome. Please refer to the [Contribution Guide](CONTRIBUTING.md). |
0 commit comments