output delegate
auto queue = new FlexibleRingQueue(/+ ... +/); // Populate the queue... void[] queue_save_data; // Save the populated queue in queue_save_data. queue.save(void[] meta, void[] head, void[] tail) { queue_save_data = meta ~ head ~ tail; } // Restore queue from queue_save_data. queue.load(void[] meta, void[] data) { // It is safe to assume meta.length is the same as in the // queue.save() callback delegate. meta[] = queue_save_data[0 .. meta.length]; void[] queue_load_data = queue_save_data[meta.length .. $]; data[] = queue_load_data[]; return queue_load_data.length; }
This method can also be called to poll the amount of space required for storing the current queue content, which is meta.length + head.length + tail.length.
The data produced by this method is accepted by the load() method of any queue where queue.length >= head.length + tail.length.
Calls the provided delegate, store(), to store the queue state and contents.
The caller may concatenate the contents of the three buffers because - it is safe to assume that load() will use the same meta.length and - load() expects to receive the head ~ tail data.