-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.rs
More file actions
26 lines (19 loc) · 763 Bytes
/
main.rs
File metadata and controls
26 lines (19 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::sync::Arc;
use rustecal::{Ecal, EcalComponents, TypedPublisher};
use rustecal_types_string::StringMessage;
fn main() {
Ecal::initialize(Some("hello send rust"), EcalComponents::DEFAULT)
.expect("eCAL initialization failed");
let publisher: TypedPublisher<StringMessage> = TypedPublisher::<StringMessage>::new("hello")
.expect("Failed to create publisher");
let mut cnt = 0;
while Ecal::ok() {
cnt += 1;
let msg = format!("HELLO WORLD FROM RUST ({})", cnt);
let wrapped = StringMessage{ data: Arc::<str>::from(msg) };
publisher.send(&wrapped);
println!("Sent: {}", wrapped.data);
std::thread::sleep(std::time::Duration::from_millis(500));
}
Ecal::finalize();
}