udt 0.1.1

Bindings to udt, a high performance data transfer protocol (based on UDP)
Documentation

pub enum UDTOpt {
    UDT_MSS,
    UDT_SNDSYN,
    UDT_RCVSYN,
    UDT_MAXBW
}

/// Doc
pub trait UdtOption<T> {
    fn get_type() -> UDTOpt;
}

macro_rules! impl_udt_opt {
    ($(#[$x:meta])*
     impl $name:ident: $ty:ty) => {
         $(#[$x])*
        pub struct $name;
        impl ::UdtOption<$ty> for $name {
            fn get_type() -> ::UDTOpt { ::UDTOpt::$name }
        }
    };
}

// part of the public interface
pub mod UdtOpts {
    impl_udt_opt! {
        /// Hello there
        /// this is multiline
        impl UDT_MSS: i32
    }
    //impl_udt_opt!(UDT_SNDSYN, bool);
    //impl_udt_opt!(UDT_RCVSYN, bool);
    //impl_udt_opt!(UDT_MAXBW, i64);
}


/// this is a 
///
/// mutlie line 
/// commend
pub fn getopt<B, T: UdtOption<B>>(opt: T) -> B {
    unimplemented!();
}

fn setopt<B, T: UdtOption<B>>(opt: T, val: B)  {
    unimplemented!();
}



fn main() {

    let x: i32 = getopt(UdtOpts::UDT_MSS);
    let y: bool = getopt(UdtOpts::UDT_SNDSYN);

    setopt(UdtOpts::UDT_MAXBW, 10);

}