docs.rs failed to build hackfn-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
hackfn-0.1.8
#[hackfn]
Fake implementation of std::ops::Fn
for user-defined data types.
Place a #[hackfn]
attribute on an impl block containing a single method to use
that method as the implementation of the function call operator.
[]
= "0.1"
Limitations
-
The function must receive
&self
. Functions that receive&mut self
orself
are not supported. -
The function may not have generic parameters or where-clause.
-
The
Self
type must implementSized
.
Examples
extern crate hackfn;
use hackfn;
/// Function object that adds some number to its input.
;
The next example is somewhat more elaborate:
-
Interior mutability can be used to approximate a
FnMut
impl. -
Generic parameters and where-clause are permitted on the impl block (though not on the function).
-
The function may take any number of arguments.
extern crate hackfn;
use hackfn;
use Cell;
use Add;
/// Function object that accumulates a pair of values per call.