#deep #flatten #nested

deep-flatten

Useful utility for deep flattening nested Options

1 unstable release

0.1.0 Feb 15, 2023

#17 in #deep

MIT license

3KB
59 lines

Deep Flatten

Deep Flatten is a simple utility trait that flattens up to 32 nested Options.

Example

use deep_flatten::DeepFlatten;

let x = Some(Some(Some(Some(Some(Some(Some(Some(Some(())))))))));
let flattened = x.deep_flatten();

assert_eq!(flattened, Some(()));

Result support coming soon.

I genuinely don't know why you will ever need this but ok

No runtime deps