From 392564ae48e7f86ef09a9729a266fb30a279f73f Mon Sep 17 00:00:00 2001 From: rex-schilasky <49162693+rex-schilasky@users.noreply.github.com> Date: Sat, 24 May 2025 17:51:43 +0200 Subject: [PATCH] rustecal-types-bytes ready to publish --- rustecal-types-bytes/Cargo.toml | 12 +++- rustecal-types-bytes/README.md | 89 ++++++++++++++++++++++++++++++ rustecal-types-protobuf/Cargo.toml | 13 ++++- rustecal-types-protobuf/README.md | 0 rustecal-types-string/Cargo.toml | 11 +++- rustecal-types-string/README.md | 0 6 files changed, 118 insertions(+), 7 deletions(-) create mode 100644 rustecal-types-bytes/README.md create mode 100644 rustecal-types-protobuf/README.md create mode 100644 rustecal-types-string/README.md diff --git a/rustecal-types-bytes/Cargo.toml b/rustecal-types-bytes/Cargo.toml index 2c373eb..47c3a41 100644 --- a/rustecal-types-bytes/Cargo.toml +++ b/rustecal-types-bytes/Cargo.toml @@ -1,11 +1,17 @@ [package] name = "rustecal-types-bytes" version = "0.1.0" +authors = ["Rex Schilasky"] edition = "2021" description = "Vec type support for rustecal TypedPublisher / TypedSubscriber" license = "Apache-2.0" +repository = "https://github.com/eclipse-ecal/rustecal" +homepage = "https://github.com/eclipse-ecal/rustecal" +documentation = "https://docs.rs/rustecal-pubsub" +readme = "README.md" +keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"] +categories = ["network-programming", "api-bindings"] [dependencies] -rustecal-core = { path = "../rustecal-core" } -rustecal-pubsub = { path = "../rustecal-pubsub" } - +rustecal-core = { version = "0.1.0", path = "../rustecal-core" } +rustecal-pubsub = { version = "0.1.0", path = "../rustecal-pubsub" } diff --git a/rustecal-types-bytes/README.md b/rustecal-types-bytes/README.md new file mode 100644 index 0000000..7a86a79 --- /dev/null +++ b/rustecal-types-bytes/README.md @@ -0,0 +1,89 @@ +# rustecal-types-bytes + +`rustecal-types-bytes` provides a simple wrapper for arbitrary binary data (`Arc<[u8]>`) to use with the typed eCAL Pub/Sub API. + +## Features + +- **BytesMessage**: wrap and transport raw binary payloads +- Implements `PublisherMessage` and `SubscriberMessage` for seamless integration +- Zero-copy where possible via `Arc<[u8]>` +- No extra dependencies beyond `rustecal-core` and `rustecal-pubsub` + +## Installation + +Add to your **workspace** `Cargo.toml`: + +```toml +[dependencies] +rustecal-types-bytes = "0.1" +``` + +## Usage + +### Publisher Example + +```rust +use std::sync::Arc; +use rustecal::{Ecal, EcalComponents, TypedPublisher}; +use rustecal_types_bytes::BytesMessage; + +fn main() -> Result<(), Box> { + Ecal::initialize(Some("blob publisher"), EcalComponents::DEFAULT)?; + + let publisher = TypedPublisher::::new("blob")?; + + let mut counter = 0u8; + while Ecal::ok() { + let buf = vec![counter; 1024]; + counter = counter.wrapping_add(1); + + let message = BytesMessage { data: Arc::from(buf) }; + publisher.send(&message); + + std::thread::sleep(std::time::Duration::from_millis(500)); + } + + Ecal::finalize(); + Ok(()) +} +``` + +### Subscriber Example + +```rust +use rustecal::{Ecal, EcalComponents, TypedSubscriber}; +use rustecal_types_bytes::BytesMessage; + +fn main() -> Result<(), Box> { + Ecal::initialize(Some("blob subscriber"), EcalComponents::DEFAULT)?; + + let mut subscriber = TypedSubscriber::::new("blob")?; + subscriber.set_callback(|message| { + println!("Received blob of {} bytes", message.payload.data.len()); + }); + + while Ecal::ok() { + std::thread::sleep(std::time::Duration::from_millis(500)); + } + + Ecal::finalize(); + Ok(()) +} +``` + +## Traits Reference + +- **`PublisherMessage`** + - `datatype() -> DataTypeInfo` + - `to_bytes(&self) -> Arc<[u8]>` + +- **`SubscriberMessage`** + - `datatype() -> DataTypeInfo` + - `from_bytes(bytes: Arc<[u8]>, _info: &DataTypeInfo) -> Option` + +## See Also + +- `rustecal-types-string` for UTF-8 string messages +- `rustecal-types-protobuf` for Protobuf-based messages +- `rustecal-types-serde` for JSON/CBOR/MessagePack via Serde +- Examples in the `rustecal-samples/pubsub` directory diff --git a/rustecal-types-protobuf/Cargo.toml b/rustecal-types-protobuf/Cargo.toml index ccb5dec..ad65b8b 100644 --- a/rustecal-types-protobuf/Cargo.toml +++ b/rustecal-types-protobuf/Cargo.toml @@ -1,9 +1,18 @@ [package] name = "rustecal-types-protobuf" version = "0.1.0" +authors = ["Rex Schilasky"] edition = "2021" +description = "Google Protobuf type support for rustecal TypedPublisher / TypedSubscriber" +license = "Apache-2.0" +repository = "https://github.com/eclipse-ecal/rustecal" +homepage = "https://github.com/eclipse-ecal/rustecal" +documentation = "https://docs.rs/rustecal-pubsub" +readme = "README.md" +keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"] +categories = ["network-programming", "api-bindings"] [dependencies] prost = "0.13.5" -rustecal-core = { path = "../rustecal-core" } -rustecal-pubsub = { path = "../rustecal-pubsub" } +rustecal-core = { version = "0.1.0", path = "../rustecal-core" } +rustecal-pubsub = { version = "0.1.0", path = "../rustecal-pubsub" } diff --git a/rustecal-types-protobuf/README.md b/rustecal-types-protobuf/README.md new file mode 100644 index 0000000..e69de29 diff --git a/rustecal-types-string/Cargo.toml b/rustecal-types-string/Cargo.toml index 8a1c1f2..4e18a8b 100644 --- a/rustecal-types-string/Cargo.toml +++ b/rustecal-types-string/Cargo.toml @@ -1,10 +1,17 @@ [package] name = "rustecal-types-string" version = "0.1.0" +authors = ["Rex Schilasky"] edition = "2021" description = "String type support for rustecal TypedPublisher / TypedSubscriber" license = "Apache-2.0" +repository = "https://github.com/eclipse-ecal/rustecal" +homepage = "https://github.com/eclipse-ecal/rustecal" +documentation = "https://docs.rs/rustecal-pubsub" +readme = "README.md" +keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"] +categories = ["network-programming", "api-bindings"] [dependencies] -rustecal-core = { path = "../rustecal-core" } -rustecal-pubsub = { path = "../rustecal-pubsub" } +rustecal-core = { version = "0.1.0", path = "../rustecal-core" } +rustecal-pubsub = { version = "0.1.0", path = "../rustecal-pubsub" } diff --git a/rustecal-types-string/README.md b/rustecal-types-string/README.md new file mode 100644 index 0000000..e69de29