Skip to content

Consider splitting PackageUrl type into owned and borrowed variants? #9

@alilleybrinker

Description

@alilleybrinker

Right now the PackageUrl type unifies owned and borrowed variants with Cow under the hood. While this works, it means that code wanting to work with owned PackageUrls either needs to thread lifetimes through their usage code which are largely irrelevant, or force 'static to ensure only string slices or non-borrowed underlying data are used.

An alternative would be to split between the owned and borrowed variant, with getter methods on the borrowed variant (and accessible to the owned variant via Deref impl), and with ownership conversion traits implemented as appropriate.

This would more closely match the String/str, PathBuf/Path, OsString/OsStr, CString/CStr split seen in other "stringy" types in the Rust standard library.

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