Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can K in Tree::Range be made ?Sized? #1497

Open
Rafferty97 opened this issue Feb 10, 2024 · 0 comments
Open

Can K in Tree::Range be made ?Sized? #1497

Rafferty97 opened this issue Feb 10, 2024 · 0 comments

Comments

@Rafferty97
Copy link

The signature of this method is currently:

    pub fn range<K, R>(&self, range: R) -> Iter
    where
        K: AsRef<[u8]>,
        R: RangeBounds<K>;

I am wondering if there is any harm in adding ?Sized to the type parameter K, as follows:

    pub fn range<K, R>(&self, range: R) -> Iter
    where
        K: AsRef<[u8]> + ?Sized,
        R: RangeBounds<K>;

I have a type for which I have implemented std::ops::RangeBounds<[u8]>, however I can't use it as a parameter to the range method due to [u8] being an unsized type, even though that shouldn't be an issue as it's only ever used in its borrowed form &[u8].

Rafferty97 added a commit to Rafferty97/sled that referenced this issue Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant