drumatech 0.1.9

a crate that has a little utility.
Documentation
/// convert byte to string with copying value.
///
/// # Examples
///
/// ```
/// extern crate drumatech;
/// use drumatech::conv;
/// let c : u8  = 0x41;
/// let s : String = conv::u8_give_string(c);
/// assert_eq!(String::from("A"),s);
/// ```
pub fn u8_give_string(mut c: u8) -> String {
    use std::slice;
    use std::str;

    str::from_utf8(slice::from_mut(&mut c)).unwrap().to_string()
}

/// convert byte to string that giving mutable reference to func.
///
/// # Examples
///
/// ```
/// extern crate drumatech;
/// use drumatech::conv;
/// let mut c : u8  = 0x41;
/// let s : String = conv::u8_to_string(&mut c);
/// assert_eq!(String::from("A"),s);
/// ```
pub fn u8_to_string(c: &mut u8) -> String {
    use std::slice;
    use std::str;
    str::from_utf8(slice::from_mut(c)).unwrap().to_string()
}
/// convert byte to string that giving mutable reference to func.
///
/// # Examples
///
/// ```
/// extern crate drumatech;
/// use drumatech::conv;
/// let mut c : Box<u8>  = Box::new(0x41);
/// assert_eq!(0x41,conv::open_box(c));
/// ```
pub fn open_box<T>(any_box: Box<T>) -> T {
    unsafe { Box::into_raw(any_box).read() }
}
/// get the value of first of Vector
///
/// # Examples
///
/// ```
/// extern crate drumatech;
/// use drumatech::conv;
/// let mut v : Vec<u8> = vec![1];
/// pub fn get<T>(v:Vec<>)
/// ```
pub fn get<T: Clone>(v: Vec<T>) -> T {
    if v.len() <= 0 {
        println!("Invalid access");
    }
    v[0].clone()
}