Skip to content

Make key externally constructable #2

@chrysn

Description

@chrysn

As this data structure verifies, on access, whether the indicated element is actually allocated (and because keys can outlive their elements anyway -- after all, they are keys and not cursors), it would be convenient to allow a key to be deserialized. Making new public would achieve that, as would a from_index constructor that (unlike new) pre-verifies that the index is within the size range (which might be better than new as it'd allow migration to internal N-dependent size types or even value-limited types as those features become available in Rust).

The particular use case I have in mind for this is the collection pattern of webservers -- it receives a POST, picks a new resource name based on the slots index, and makes that resource accessible until it gets DELETEd. When the client comes back to access or deletes the resource, it passes the key in as a path component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions