[][src]Function tao_of_rust::ch02::function::two_times_impl

pub fn two_times_impl(
) -> impl Fn(i32) -> i32

闭包: 作为返回值(静态分发)

Basic usage:

fn two_times_impl() -> impl Fn(i32) -> i32{
    let i = 2;
    move |j| j * i
}
let result = two_times_impl();
assert_eq!(result(2), 4);Run