[][src]Module kul::drop

Custom handling of dropping for the heap-allocated Datum types of this crate. Enables using very-deep Datum trees, e.g. long lists, which would otherwise cause stack overflows when droppped (due to the compiler's automatic recursive dropping). Can also be used for any other Datum reference types of yours if they meet the requirements.

Traits

Algo1DatumRef

Exists so that Datums can be moved-out of the reference types that refer to them, even when there are other weak references.

RcLike

Allows generically working with Datum reference types that wrap Rc-like types, such as Rc and Arc. Could also be used for other, non-standard, types that are like Rc.

RcLikeAtomicCounts

Allows generically working with Datum reference types that wrap Rc-like types that can supply both strong and weak reference counts atomically. Currently, this is only Rc, but hopefully in the future Arc can be included as well if it can provide the ability to get both counts atomically. This could also be used for other, non-standard, types that meet the requirements.

Functions

algo1

Avoids extensive recursive dropping by using a loop and moving-out the Datum values to iteratively unlink and drop the references to other Datums they contain, instead of relying on the default automatic recursive field dropping that would do recursive drop calls which would overflow the stack for very-long reference chains (e.g. long lists or very-deep nests). Enables using very-long chains of Datum references, which is essential for this crate to be robust.