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

Steal good commits from #44 #47

Merged
merged 4 commits into from
Jan 30, 2020
Merged

Steal good commits from #44 #47

merged 4 commits into from
Jan 30, 2020

Conversation

jonhoo
Copy link
Owner

@jonhoo jonhoo commented Jan 30, 2020

This steals a bunch of the commits from #44 that are not related to no_std, and should land independently of whether we merge no_std support.

Pablo Escobar Gaviria added 4 commits January 30, 2020 15:38
Now the `S` type parameter is only required to implement `Default`.
This makes the methods more consistent with one another, allows for
greater efficiency, and are necessary for potential eventual `no_std`
support.
We choose this over `std`'s `RandomState` for two reasons:

 1. It is faster, and the DoS protection will be provided by the (as of
    yet unimplemented) `TreeBin` optimization.
 2. It is more amenable to `no_std` environments.
@codecov
Copy link

codecov bot commented Jan 30, 2020

Codecov Report

Merging #47 into master will decrease coverage by 0.07%.
The diff coverage is 100%.

Impacted Files Coverage Δ
src/map.rs 88.2% <100%> (-0.11%) ⬇️

jonhoo added a commit that referenced this pull request Jan 30, 2020
This is essentially 7b32a16 rebased on
top of #47.
jonhoo added a commit that referenced this pull request Jan 30, 2020
This is necessary since there is no particular lock implementation that
"makes sense" on `no_std`. This patch changes all types to be generic
over any lock type that implements `lock_api::RawMutex`, and defaults to
`parking_lot::RawMutex` on `std`.

Note that this patch forks the struct definition for `HashMap` into one
for `std` (which has a default for `L`) and one for `no_std` (which does
not). This is fine since any code written _without_ the `std` feature
_will_ compile with the `std` feature enabled (`indexmap` does the same;
the reverse is not true). We _could_ introduce an intermediate private
struct to avoid repeating the definition, but it would require writing
`self.inner` all over the place, which would be sad. This seemed
marginally cleaner.

Also, this diff makes me want implied bounds a lot:
rust-lang/rust#44491

This is essentially a rebase of adb58e0
and f9ad723 on top of the previous
commit + #47.
@jonhoo jonhoo requested a review from cuviper January 30, 2020 21:25
@jonhoo jonhoo merged commit 39f439f into master Jan 30, 2020
@jonhoo jonhoo deleted the steal-from-44 branch January 30, 2020 21:55
jonhoo added a commit that referenced this pull request Jan 30, 2020
This is essentially 7b32a16 rebased on
top of #47.
jonhoo added a commit that referenced this pull request Jan 30, 2020
This is necessary since there is no particular lock implementation that
"makes sense" on `no_std`. This patch changes all types to be generic
over any lock type that implements `lock_api::RawMutex`, and defaults to
`parking_lot::RawMutex` on `std`.

Note that this patch forks the struct definition for `HashMap` into one
for `std` (which has a default for `L`) and one for `no_std` (which does
not). This is fine since any code written _without_ the `std` feature
_will_ compile with the `std` feature enabled (`indexmap` does the same;
the reverse is not true). We _could_ introduce an intermediate private
struct to avoid repeating the definition, but it would require writing
`self.inner` all over the place, which would be sad. This seemed
marginally cleaner.

Also, this diff makes me want implied bounds a lot:
rust-lang/rust#44491

This is essentially a rebase of adb58e0
and f9ad723 on top of the previous
commit + #47.
jonhoo added a commit that referenced this pull request Jan 30, 2020
This is essentially 7b32a16 rebased on
top of #47.
jonhoo added a commit that referenced this pull request Jan 30, 2020
This is necessary since there is no particular lock implementation that
"makes sense" on `no_std`. This patch changes all types to be generic
over any lock type that implements `lock_api::RawMutex`, and defaults to
`parking_lot::RawMutex` on `std`.

Note that this patch forks the struct definition for `HashMap` into one
for `std` (which has a default for `L`) and one for `no_std` (which does
not). This is fine since any code written _without_ the `std` feature
_will_ compile with the `std` feature enabled (`indexmap` does the same;
the reverse is not true). We _could_ introduce an intermediate private
struct to avoid repeating the definition, but it would require writing
`self.inner` all over the place, which would be sad. This seemed
marginally cleaner.

Also, this diff makes me want implied bounds a lot:
rust-lang/rust#44491

This is essentially a rebase of adb58e0
and f9ad723 on top of the previous
commit + #47.
@GarkGarcia
Copy link
Contributor

Awesome! I'm happy I could help 😃

jonhoo added a commit that referenced this pull request Feb 1, 2020
This is essentially 7b32a16 rebased on
top of #47.
jonhoo added a commit that referenced this pull request Feb 1, 2020
This is necessary since there is no particular lock implementation that
"makes sense" on `no_std`. This patch changes all types to be generic
over any lock type that implements `lock_api::RawMutex`, and defaults to
`parking_lot::RawMutex` on `std`.

Note that this patch forks the struct definition for `HashMap` into one
for `std` (which has a default for `L`) and one for `no_std` (which does
not). This is fine since any code written _without_ the `std` feature
_will_ compile with the `std` feature enabled (`indexmap` does the same;
the reverse is not true). We _could_ introduce an intermediate private
struct to avoid repeating the definition, but it would require writing
`self.inner` all over the place, which would be sad. This seemed
marginally cleaner.

Also, this diff makes me want implied bounds a lot:
rust-lang/rust#44491

This is essentially a rebase of adb58e0
and f9ad723 on top of the previous
commit + #47.
jonhoo added a commit that referenced this pull request Feb 3, 2020
This is essentially 7b32a16 rebased on
top of #47.
jonhoo added a commit that referenced this pull request Feb 3, 2020
This is necessary since there is no particular lock implementation that
"makes sense" on `no_std`. This patch changes all types to be generic
over any lock type that implements `lock_api::RawMutex`, and defaults to
`parking_lot::RawMutex` on `std`.

Note that this patch forks the struct definition for `HashMap` into one
for `std` (which has a default for `L`) and one for `no_std` (which does
not). This is fine since any code written _without_ the `std` feature
_will_ compile with the `std` feature enabled (`indexmap` does the same;
the reverse is not true). We _could_ introduce an intermediate private
struct to avoid repeating the definition, but it would require writing
`self.inner` all over the place, which would be sad. This seemed
marginally cleaner.

Also, this diff makes me want implied bounds a lot:
rust-lang/rust#44491

This is essentially a rebase of adb58e0
and f9ad723 on top of the previous
commit + #47.
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.

None yet

2 participants