Skip to content

Docs for result::collect and option::collect should use boxed pointers and Vecs #14991

Closed
@nathantypanski

Description

@nathantypanski

They both follow basically the same format:

fn inc_conditionally(x: uint) -> Option<uint> {
    if x == uint::MAX { return None; }
    else { return Some(x+1u); }
}
let v = [1u, 2, 3];
let res = collect(v.iter().map(|&x| inc_conditionally(x)));
assert!(res == Some(~[2u, 3, 4]));

These should be updated to use box and Vec.

Edit:

  • Updated title to reflect below comment. No box was necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions