fn from_slice(bytes: &[u8]) -> Buffer {
    let vec: Vec<u8> = bytes.to_vec();
    let mut result = [0; 2048];
    if bytes.len() > 2048 { println!("todo to small buffer"); }
    for i in 0..2048 {
        result[i] = match vec.get(i) {
            Some(val) => *val,
            None => 0,
        }
    }
    result
}
/// Converts a byte slice into a fixed length portion
Converts a byte slice into a fixed length portion
Converts a byte slice into a fixed length portion
fn from_slice(bytes: &[u8]) -> Buffer {
    let vec: Vec<u8> = bytes.to_vec();
    let mut result = [0; 2048];
    if bytes.len() > 2048 { println!("todo to small buffer"); }
    for i in 0..2048 {
        result[i] = match vec.get(i) {
            Some(val) => *val,
            None => 0,
        }
    }
    result
}
fn from_slice ( bytes : & [ u8 ] ) -> Buffer { let vec : Vec < u8 > = bytes . to_vec ( ) ; let mut result = [ 0 ; 2048 ] ; if bytes . len ( ) > 2048 { println ! ( " " ) ; } for i in 0 .. 2048 { result [ i ] = match vec . get ( i ) { Some ( val ) => * val , None => 0 , } } result }
Converts a byte slice into a fixed length portion
Converts a byte slice into a fixed length portion
bytes
&[u8]
bytes
&[u8]