Skip to content

Provide explicit borrowed-view vs owned-copy APIs #42

Description

@Hihi142

Hi, thanks for Vest.

I'd like to suggest exposing two clearly separated API modes:

  • borrowed / view-based: parsed values borrow from the input buffer
  • owned / copy-based: parsed values are detached copies of the input data

Right now, the zero-copy direction seems to be the default, but from the API it is not always immediately clear whether a result is:

  • a borrow/view into the original input buffer, or
  • an owned copy

In some cases I encountered, an owned copy is actually preferred over a borrow.

It would be helpful if Vest could make this distinction explicit, for example with two API families such as:

  • parse_borrowed / parse_view
  • parse_owned

and possibly matching generated types like:

  • FooRef<'a>
  • FooOwned

This would make ownership semantics much clearer for users and reduce confusion around lifetimes vs copied data.

Thanks for considering it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions