Skip to content

der: add AnyCow #1959

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

dishmaker
Copy link
Contributor

AnyRef, that allocates as Any with alloc feature

@tarcieri
Copy link
Member

I would prefer not to have any of these types that try to special case Cow.

We can likely do something similar to what I proposed in #1795 for Any/AnyRef using tagged pointers to store the tag for AnyRef

@tarcieri
Copy link
Member

Hmm, one problem with tagged pointers is that the Tag type can now need up to 48-bits to represent, which can't be stored in e.g. a 32-bit tagged pointer

@dishmaker
Copy link
Contributor Author

Yes, the Tag alongside &'a [u8] is a problem.

One parallel solution is:

pub struct AnyCow<'a> {
    tag: Tag,
    value: Cow<'a, BytesRef>,
}

but that wouldn't be alloc-gated on allocating variant.

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

Successfully merging this pull request may close these issues.

2 participants