Expand description

Memoization offers a simple generic enum that allows for variables and structure fields to become memoized. This crate only has 1 instance of unsafe code within itself.

The goal of this crate is to enable complex/timely operations that only need to be performed once to only be done once. And then to be accessed via a structure field, and borrowed like a normal structure field. Not though weird function or memory allocation patterns.

When constructed Memoized will be as large as the constructed field. The act of writing to, or processing/initializing the field does not cost allocations (unless the initalizer lambda does). The minimum size is 2 pointers.

The deref, derefmut, and borrow fields are overloaded. So as a structure field the contained data can be written to, and borrowed as if it was the normal field it constructs. derefmut does contain unsafe code, to allow the user to write to the uninitailized field. This is mearly to cut down on allocations performed.

I believe this should be able to be ported to core, as none of its code necessarily needs standard. This maybe a future change.

Enums

Magical Enum