SSILIDE-UDP

Simple Single Instancing and Local Interprocess Data Exchange using UDP Socket

Intended usage: - Enforcing single process instance at a time - Communicating events to current process instance claimant

Example:

```rs const INTERFACE: ssilide::Interface = ssilide::interface(43615);

[repr(u8)]

[derive(numenum::IntoPrimitive, numenum::TryFromPrimitive)]

// Represents the different messages that may be sent to the // currently claiming process. Since only ever 1 byte is sent, // there may be up to 255 different messages. // Anything that implements Into and TryFrom works. enum Message { FocusRequested, }

fn main() { // This process will either exit or block all other processes trying // to claim this interface until it drops its claim. // If the interface is already claimed, tell the claiming process // to do something (here: focus its window). let claim = INTERFACE.claimorsendandexit(Message::FocusRequested);

// The claiming process can listen for incoming messages and act
// accordingly.
loop {
    match claim.read_message() {
        None => {},
        Some(Err(e)) => eprintln!("failed to read message {e}"),
        Some(Ok(message)) => match message {
            Message::FocusRequested => println!("focus requested!!"),
        }
    }

    std::thread::sleep(std::time::Instant::from_secs(1));
}

} ```