Skip to content

Allow giving ownership of slice to Heap #8

@hellow554

Description

@hellow554

Currently When I want something like

fn foo(a: &mut Vec<u8>) -> impl Iterator<Item=u8> {
    Heap::new(&mut a).map(|h| 0)
}

it won't work, because it says, that a won't live long enough, so I have to do it like

fn foo(a: &mut Vec<u8>) -> impl Iterator<Item=u8> {
    let heap = Heap::new(&mut a).collect::<Vec<_>>();
    heap.into_iter().map(|h| 0)
}

which is ... meh. Either accepting a slice and hold an internal mutable buffer, or taking a slice as value and store it inside, but this &mut causes some trouble.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions