udp_netmsg 0.2.0

A low cost abstraction for sending and receiving udp datagrams. Gives ability to send and receive datagrams defined by custom structs in a simple way
Documentation
use std::sync::{Arc, Mutex};

#[doc(hidden)]
pub struct ThreadSafe<T> {
    obj: Arc<Mutex<T>>
}

impl <T>ThreadSafe<T> {
    pub fn lock(&self)->Result<std::sync::MutexGuard<'_, T>,
    std::sync::PoisonError<std::sync::MutexGuard<'_, T>>>
    {
        return self.obj.lock()
    }

    pub fn clone(&self)->ThreadSafe<T> {
        return ThreadSafe{obj: self.obj.clone()}
    }

    pub fn from(obj: T)->ThreadSafe<T> {
        return ThreadSafe{obj: Arc::from(Mutex::from(obj))}
    }
}