| Crates.io | rustecal-types-string |
| lib.rs | rustecal-types-string |
| version | 0.1.5 |
| created_at | 2025-05-24 18:38:09.345247+00 |
| updated_at | 2025-08-25 21:10:31.100694+00 |
| description | String type support for rustecal TypedPublisher/TypedSubscriber |
| homepage | |
| repository | https://github.com/eclipse-ecal/rustecal |
| max_upload_size | |
| id | 1687679 |
| size | 26,664 |
rustecal-types-string provides a simple wrapper for UTF-8 string messages (Arc<str>) to use with the typed eCAL Pub/Sub API.
PublisherMessage and SubscriberMessage for seamless integrationArc<str>rustecal-core and rustecal-pubsubAdd to your workspace Cargo.toml:
[dependencies]
rustecal-types-string = "0.1"
use rustecal::{Ecal, EcalComponents, TypedPublisher};
use rustecal_types_string::StringMessage;
fn main() -> Result<(), Box<dyn std::error::Error>> {
Ecal::initialize(Some("string publisher"), EcalComponents::DEFAULT, None)?;
let publisher = TypedPublisher::<StringMessage>::new("hello")?;
while Ecal::ok() {
let message = StringMessage { data: "Hello from Rust".into() };
publisher.send(&message, Timestamp::Auto);
std::thread::sleep(std::time::Duration::from_millis(500));
}
Ecal::finalize();
Ok(())
}
use rustecal::{Ecal, EcalComponents, TypedSubscriber};
use rustecal_types_string::StringMessage;
fn main() -> Result<(), Box<dyn std::error::Error>> {
Ecal::initialize(Some("string subscriber"), EcalComponents::DEFAULT, None)?;
let mut subscriber = TypedSubscriber::<StringMessage>::new("hello")?;
subscriber.set_callback(|message| {
println!("Received: {}", message.payload.data)
});
while Ecal::ok() {
std::thread::sleep(std::time::Duration::from_millis(500));
}
Ecal::finalize();
Ok(())
}
PublisherMessage
fn datatype() -> DataTypeInfofn to_bytes(&self) -> Arc<[u8]>SubscriberMessage
fn datatype() -> DataTypeInfofn from_bytes(bytes: Arc<[u8]>, _data_type_info: &DataTypeInfo) -> Option<Self>rustecal-types-bytes for raw binary data messagesrustecal-types-protobuf for Protobuf-based messagesrustecal-types-serde for JSON/CBOR/MessagePack via Serderustecal-samples/pubsub directory