Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions rustecal-types-bytes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
[package]
name = "rustecal-types-bytes"
version = "0.1.0"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Vec<u8> 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" }
89 changes: 89 additions & 0 deletions rustecal-types-bytes/README.md
Original file line number Diff line number Diff line change
@@ -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<dyn std::error::Error>> {
Ecal::initialize(Some("blob publisher"), EcalComponents::DEFAULT)?;

let publisher = TypedPublisher::<BytesMessage>::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<dyn std::error::Error>> {
Ecal::initialize(Some("blob subscriber"), EcalComponents::DEFAULT)?;

let mut subscriber = TypedSubscriber::<BytesMessage>::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<Self>`

## 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
13 changes: 11 additions & 2 deletions rustecal-types-protobuf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
Empty file.
11 changes: 9 additions & 2 deletions rustecal-types-string/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
Empty file added rustecal-types-string/README.md
Empty file.