-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Problem We'd like to expand the functionality of `BTreeMap` to support unbounded types. To add this support in a backward-compatible way, the `BTreeMap` would need to support both bounded types (i.e. types that implement `BoundedStorable`) and unbounded types (i.e. types that don't implement `BoundedStorable`). Rust doesn't support generic specializations, so we cannot have the same `BTreeMap` support both use-cases simultaneously. It can either support only `BoundedStorable` types, or all types implementing `Storable`, but without the knowledge of whether a `BoundedStorable` implementation is available for those types. ## Solution Merge `BoundedStorable` and `Storable` into the same trait. The one downside of this approach is that checking whether or not a bound exists now happens at run-time. This impacts the developer experience. Prior to the PR, if you try to store a `String` inside a `StableVec`, the compiler will complain that `String` doesn’t implement `BoundedStorable`. But, with this solution, it’ll happily compile, and only when you run your code will you see a panic that `String` is not bounded. This PR relates to #84 and #69.
- Loading branch information
Showing
14 changed files
with
610 additions
and
559 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.