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

Borrow - experimental sketch, DO NOT MERGE #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ijackson
Copy link

In #22 I wrote

An alternative would be to have a nonoptimised UnicaseNoOpt<str> which could be transparent, so that &'s UnicaseNoOpt<str> can be made from &'s str with one transmute.

This problem nerdsniped me. The result is this branch. Now we can do this:

    let mut hm: HashSet<UniCase<String>> = Default::default();
    hm.insert(UniCase::new("ascii".to_string()));
    assert!(hm.contains(UniCaseNoOpt::from_ref("Ascii")));

which is great! My actual code is not really finished - no docs, probably style problems, and many trait impls etc. missing. (It does pass miri, which is a thing I always check with unsafe)

But I thought I should share it. If people like this direction, it could be tidied up.

This is really very slow under emulation.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This seems to work.  At least it passes the one test I wrote.
@ijackson
Copy link
Author

Obviously this direction is not compatible with #36 which forbids unsafe. I think Borrow is rather more important.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
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.

1 participant