Difference between Ret
and Fwd
Both of these types allow specifying a callback or call-forward, usually to an actor method but possibly to some other destination. But there are some important differences:
Ret
can be called only once, andFwd
may be called many timesRet
cannot be cloned, butFwd
has ref-counting and there may be many references to the sameFwd
callbackRet
can capture "move" typesRet
is consumed when it is calledRet
notifies the callback if it is dropped without being called
Whilst the names suggest uses of returning or forwarding data, there
are no restrictions about where the data is sent. So a Ret
may
'return' data back to some other actor than the caller if required.