Skip to content

core::at_vec should have from_owned and from_slice functions #4553

@Dretch

Description

@Dretch

Currently core::at_vec has constructor functions including build, build_sized, build_sized_opt, from_fn and from_elem.

As far as I understand, none of these allow constructing an @vec by moving (rather than copying) all the values from a ~vec.

Therefore, I think it would be good if core::at_vec gained a function like:

pub fn from_owned<T>(v: ~[T]) -> @[T] { ... }

and, for convenience, something like this too:

pub fn from_slice<T:Copy>(v: &[T]) -> @[T] { ... }

Is this proposal something desirable? If so I will try and submit code/docs/tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions