Expand description
A Rust library for sending nDisplay cluster events.
Read more about nDisplay cluster events via the unreal documentation.
§Json Event Example
Run this example with cargo run --example send_json.
use ndisplay_cluster_events::{JsonEvent, WriteJsonEvent};
use std::net::TcpStream;
fn main() {
// Open a connection to nDisplay on the local host.
let address = format!("localhost:{}", JsonEvent::DEFAULT_PORT);
let mut stream = TcpStream::connect(address).unwrap();
// Create a `JsonEvent` with some data.
let json_event = JsonEvent {
name: "MyJsonEvent".into(),
..Default::default()
};
// Send the event.
stream.write_json_event(&json_event).unwrap();
}§Binary Event Example
Run this example with cargo run --example send_binary.
use ndisplay_cluster_events::{BinaryEvent, WriteBinaryEvent};
use std::net::TcpStream;
fn main() {
// Open a connection to nDisplay on the local host.
let address = format!("localhost:{}", BinaryEvent::DEFAULT_PORT);
let mut stream = TcpStream::connect(address).unwrap();
// Create a `BinaryEvent` with some data.
let binary_event = BinaryEvent {
id: 42,
data: [1, 2, 3].as_slice().into(),
..Default::default()
};
// Send the event.
stream.write_binary_event(&binary_event).unwrap();
}Re-exports§
pub use serde;pub use serde_json;
Structs§
- Binary
Event - nDisplay binary cluster event data.
- Json
Event - nDisplay json cluster event data.
Can be converted to and from actual json data using
serde_json.
Enums§
- Send
Event Error - Errors that may occur when sending an event to a writer.
Traits§
- Write
Binary Event - The trait for writing
BinaryEvents. It is automatically implemented for everything that implementsstd::io::Write. - Write
Json Event - The trait for writing
JsonEvents. It is automatically implemented for everything that implementsstd::io::Write.