Comments (5)
CC me (need to think about this a bit more...)
from compare.
I've only looked at this crate for a very short while. How to handle the .get<Q: ?Sized>()
model that maps have?
Without a type parameter on Natural
, at least it is fine to use with both Compare<K>
and Compare<Q>
I tried the following, which fails because the default comparator is C = Natural<K>
so the restriction C: Compare<Q>
forces K == Q
:(
pub fn contains<Q: ?Sized>(&self, key: &Q) -> bool
where K: Borrow<Q>,
C: Compare<Q>,
{
With this said, I think for this use case a phantom-type based approach works better. Custom closure comparators can't cope with the Q vs K scheme anyway.
from compare.
This is super out of cache but I think the Borrow adaptor is supposed to be for that...?
https://github.com/contain-rs/compare/blob/master/src/lib.rs#L215-L234
from compare.
aha thanks!
from compare.
Hm I can't figure out how to use it. I don't think I can, if I require my Bmap<K, V, C>
to have a C: Compare<K>
, then that can't be converted in any way into something that can compare two borrowed Q
values (where K: Borrow<Q>
).
from compare.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compare.