Crates.io | take_put_back |
lib.rs | take_put_back |
version | 0.1.2 |
source | src |
created_at | 2024-07-22 22:21:58.79551 |
updated_at | 2024-10-11 20:52:29.450045 |
description | A common abstraction of the process of taking some piece out, processing it and then putting it back. |
homepage | |
repository | https://github.com/Cobord/TakePutBack |
max_upload_size | |
id | 1312200 |
size | 23,762 |
A common abstraction of the process of taking some piece out, processing it and then putting it back.
Assuming these operations being independent (any side effects should not matter how they are interleaved), there is a default implementation of process_all as threaded execution of multiple of these. If doing this, you only provide the simpler take and put back implementations. This means this is assuming that this processing step is the intense part, so that there is a gain from sending each chunk to be done on it's own thread before putting it back.
Do this on all the pieces of a collection. Then we are thinking fmap and the f is of type T->T. The way you index for taking out and putting back are the same, but that is not the case in general. These are the vector examples and the ones which are changing the data on the nodes/edges of a graph.
There is also an example with graphs were taking out a node and putting in a new graph. This is a case to show where the types used for taking something out and for putting something back in are different.