Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Is there any way to construct a callable value in the stable version of Rust?
Consider a certain API that is designed as follows:
pub fn update<F>(f:F) where F:FnOnce(i32){/* ... */}
Besides using closure to capture the environment variable, is there any way to construct a customized data structure that is callable in the stable version of Rust? Something like this:
struct Callable{
data: Data,
}
update(Callable{data:Data{/* ... */}});
2 posts - 2 participants
🏷️ Rust_feed