Mojo function
merge
merge[type: CollectionElement, span_lifetime: ImmutableLifetime, result_lifetime: MutableLifetime, //, cmp_fn: fn(_SortWrapper[$0], _SortWrapper[$0]) capturing -> Bool](span1: Span[0, type, span_lifetime], span2: Span[0, type, span_lifetime], result: Span[1, type, result_lifetime])
Merge span1 and span2 into result using the given cmp_fn. The function will crash if result is not large enough to hold both span1 and span2.
Note that if result contains data previously, its destructor will not be called.
Parameters:
- type (
CollectionElement
): Type of the spans. - span_lifetime (
ImmutableLifetime
): Lifetime of the input spans. - result_lifetime (
MutableLifetime
): Lifetime of the result Span. - cmp_fn (
fn(_SortWrapper[$0], _SortWrapper[$0]) capturing -> Bool
): Comparison functor of (type, type) capturing -> Bool type.
Args:
- span1 (
Span[0, type, span_lifetime]
): The first span to be merged. - span2 (
Span[0, type, span_lifetime]
): The second span to be merged. - result (
Span[1, type, result_lifetime]
): The output span.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
😔 What went wrong?