Skip to content

Add Revspec::into_objects #1147

Open
Open
@lolbinarycat

Description

@lolbinarycat

It is currently not possible to extract the Objects from a Revspec without cloning, which is wasteful, since these are heap objects.

If this was a simple struct, you could just move out of the fields, but because it needs to be accessed through getter methods, this is not possible, and thus a separate method is needed.

impl<'repo> Revspec<'repo> {
  // RevparseMode is `Copy`, so it doesn't need to be returned in destructuring,
  // although maybe it should be for symmetry.
  fn into_objects(self) -> (Option<Object<'repo>>,  Option<Object<'repo>>);
}

This would be useful for when you want to collect all the commits into a Vec.

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