I tried to run the FnBox
example from the official docs but it throws an error:
error[E0432]: unresolved import `std::boxed::FnBox`
--> src/main.rs:4:5
|
4 | use std::boxed::FnBox;
| ^^^^^^^^^^^^^^^^^ no `FnBox` in `boxed`
It's easy to get this error using the rust playground, and I got the same error locally.
Actually I found some declarations from std locally:
#[rustc_paren_sugar]
#[unstable(feature = "fnbox",
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
pub trait FnBox<A>: FnOnce<A> {
/// Performs the call operation.
fn call_box(self: Box<Self>, args: A) -> Self::Output;
}
#[unstable(feature = "fnbox",
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
impl<A, F> FnBox<A> for F
where F: FnOnce<A>
{
fn call_box(self: Box<F>, args: A) -> F::Output {
self.call_once(args)
}
}
But there's still an error.