Skip to content

Commit 7fafbbd

Browse files
committed
docs added
1 parent 7e445cf commit 7fafbbd

File tree

6 files changed

+125
-0
lines changed

6 files changed

+125
-0
lines changed

rustecal/docs/book.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[book]
2+
title = "rustecal Documentation"
3+
authors = ["Rex Schilasky"]
4+
language = "en"
5+
multilingual = false
6+
src = "src"

rustecal/docs/src/SUMMARY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Summary
2+
3+
- [Introduction](introduction.md)
4+
- [Usage Guide](usage.md)
5+
- [Message Types](types.md)
6+
- [Architecture Overview](architecture.md)

rustecal/docs/src/architecture.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Architecture Overview
2+
3+
## Overview
4+
5+
`rustecal` builds safe wrappers around the C-based eCAL API, offering two layers:
6+
7+
1. **Low-level Bindings (`rustecal-sys`)**:
8+
- Generated via `bindgen`
9+
- Exposes raw `unsafe` functions
10+
11+
2. **Safe High-Level API (`rustecal`)**:
12+
- Encapsulates lifecycle management
13+
- Provides typed pub/sub
14+
- Modular message type support
15+
16+
## High-Level Modules
17+
18+
- `Ecal` – initialization/finalization of runtime
19+
- `Publisher`/`Subscriber` – low-level pub/sub
20+
- `TypedPublisher`/`TypedSubscriber` – type-safe wrappers
21+
- `DataTypeInfo` – describes encoding, type name, and optional descriptor
22+
23+
## Message Types as Crates
24+
25+
Each type support lives in a separate crate to reduce dependency bloat:
26+
27+
- `rustecal-types-bytes`
28+
- `rustecal-types-string`
29+
- `rustecal-types-protobuf`

rustecal/docs/src/introduction.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Introduction
2+
3+
Welcome to **rustecal**, a safe and idiomatic Rust binding for [Eclipse eCAL](https://github.com/eclipse-ecal/ecal).
4+
5+
This project is designed to bring fast and reliable pub-sub and service-based IPC to Rust-based applications in domains such as robotics, automotive, embedded, and distributed systems.
6+
7+
rustecal wraps the low-level `ecal_c` C API and builds ergonomic, type-safe abstractions for working with:
8+
9+
- Publishers and Subscribers
10+
- Strongly typed message serialization (e.g., Strings, Bytes, Protobuf)
11+
- Cross-platform interprocess communication
12+
13+
This documentation will guide you through usage, architecture, and message type support.

rustecal/docs/src/types.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Message Types
2+
3+
rustecal supports several message formats, wrapped in type-safe crates:
4+
5+
## `BytesMessage`
6+
7+
Raw byte buffers.
8+
9+
```rust
10+
use rustecal_types_bytes::BytesMessage;
11+
12+
let msg = BytesMessage(vec![1, 2, 3]);
13+
```
14+
15+
## `StringMessage`
16+
17+
UTF-8 encoded Rust strings.
18+
19+
```rust
20+
use rustecal_types_string::StringMessage;
21+
22+
let msg = StringMessage("hello world".into());
23+
```
24+
25+
## `ProtobufMessage<T>`
26+
27+
Support for `prost::Message`-based Protobuf types.
28+
29+
```rust
30+
use rustecal_types_protobuf::ProtobufMessage;
31+
use myproto::MyMessage;
32+
33+
let msg = ProtobufMessage(MyMessage::default());
34+
```

rustecal/docs/src/usage.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Usage Guide
2+
3+
## Initialization
4+
5+
Before using any publisher or subscriber, initialize the eCAL runtime:
6+
7+
```rust
8+
use rustecal::{Ecal, EcalComponents};
9+
10+
fn main() {
11+
Ecal::initialize(Some("my_node"), EcalComponents::DEFAULT).unwrap();
12+
// ...
13+
Ecal::finalize();
14+
}
15+
```
16+
17+
## Publishing Strings
18+
19+
```rust
20+
use rustecal::{TypedPublisher};
21+
use rustecal_types_string::StringMessage;
22+
23+
let pub_ = TypedPublisher::<StringMessage>::new("hello").unwrap();
24+
pub_.send(&StringMessage("Hello from Rust".into()));
25+
```
26+
27+
## Subscribing to Strings
28+
29+
```rust
30+
use rustecal::{TypedSubscriber};
31+
use rustecal_types_string::StringMessage;
32+
33+
let mut sub = TypedSubscriber::<StringMessage>::new("hello").unwrap();
34+
sub.set_callback(|msg| {
35+
println!("Received: {}", msg.msg.0);
36+
});
37+
```

0 commit comments

Comments
 (0)