rust里closure的move和Fn,FnMut,FnOnce

https://www.reddit.com/r/rust/comments/2ti57s/iron_framework_and_lifetime_problems_with/.

There seems to be two cases where a captured value is moved, copied or borrowed: when a closure is made (creating the struct with function pointer and the relevant environment) and when a closure is called. Did I understand right: move keyword means that a value is moved into the struct when a closure is CREATED. And Fn, FnMut and FnOnce decide how a value is moved/borrowed from the struct to the function body when a closure is CALLED?

That’s exactly right - they are orthogonal.
move || is just asking rustc to attempt to infer the kind of closure, referring to Fn/FnMut/FnOnce.

你可能感兴趣的:(closure,move,Rust)