fn main() {
  fn f<T>(arr : &mut Vec<i32>) -> Option<i32>{
      if arr.len() > 0 {
          Some(arr.len() as i32)
      } else {
          None
      }
  }
  
  let mut vec : Vec<i32> = vec![1,2,3,4,5];
  let res = f::<&mut Vec<i32>>(&mut vec);
  println!("{:?}",res);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: