Structs
FBox
is a generic wrapper of a unary function. FBox
lets you compose unary functions via a user friendly syntax and in a type-safe manner.
FBox
works with functions that take ownership over their argument. This way you can exploit the ownership rules of Rust.
FBox
is lazy. It only calls its function when you explicitly tell it to do so. You can call apply
or apply_drop
with a single argument, the type of which corresponds to the FIn
type parameter of the FBox
. The return type will correspond to the FOut
type parameter.Traits
The
Apply
trait makes it possible to apply a unary function inside a wrapper. The apply
method does not take ownership over the wrapper, but it does take ownership over the argument.The
ApplyDrop
trait works similarly to Apply
, except the apply_drop
method takes ownership over the wrapper.