rustlings

solving rustlings ft. dracuxan
git clone [email protected]:dracuxan/rustlings.git
Log | Files | Refs

vecs1.rs (392B)


      1 fn array_and_vec() -> ([i32; 4], Vec<i32>) {
      2     let a = [10, 20, 30, 40]; // Array
      3 
      4     // Used the `vec!` macro.
      5     let v = vec![10, 20, 30, 40];
      6 
      7     (a, v)
      8 }
      9 
     10 fn main() {
     11     // You can optionally experiment here.
     12 }
     13 
     14 #[cfg(test)]
     15 mod tests {
     16     use super::*;
     17 
     18     #[test]
     19     fn test_array_and_vec_similarity() {
     20         let (a, v) = array_and_vec();
     21         assert_eq!(a, *v);
     22     }
     23 }