Write the following 3 functions in Rust:squarelist:Borrows a Vec argument and returns a new Vec holding the squares ofthe original elements.fn squarelist(v: &Vec) -> Vec {}sqsum:Borrows a Vec and returns the sum of the squares of the original elements asan i32.fn sqsum(v: &Vec) -> i32 {}compose_n:Write a generic function that borrows a vector of unary functions and returns aclosure that represents the composition of the passed functions. The signature of thegeneric function is:fn compose_n<'a, T>(funs: &'a [fn(T) -> T]) -> impl Fn(T) -> T + 'a {}The lifetime parameter 'a denotes that the closure does not outlive the parameter(funs). Note that funs is a slice.You will need to precede your closure with the move keyword.All 3 of the functions can be written in a single line using iterators, adapters, andconsumers, as needed (e.g., collect, fold, iter, map, rev).