t_wの輪郭

RustのクロージャはFn特質を実装しているFnRustimpl

あれ

2022/2/25 23:51:00
fn test(closure: impl Fn(u32)->u32) {
    assert_eq!(closure(10), 11);
}

let closure = |x| {
    x+1
};

test(closure);
あれ