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(); }