-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change makes it possible to use other primitives as keys. There are a lot of function-level constraints, which could be either aliased, or lifted to the impl clause, but I prefer to have the minimal set on a per-function basis. This is a breaking change, because of the introduction of the extra type parameter.
- Loading branch information
Showing
12 changed files
with
331 additions
and
127 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
pub trait HighestPrime { | ||
fn highest_prime() -> Self; | ||
} | ||
|
||
impl HighestPrime for u64 { | ||
#[inline(always)] | ||
fn highest_prime() -> Self { | ||
18_446_744_073_709_551_557 | ||
} | ||
} | ||
|
||
impl HighestPrime for u32 { | ||
#[inline(always)] | ||
fn highest_prime() -> Self { | ||
2_147_483_647 | ||
} | ||
} | ||
|
||
impl HighestPrime for u16 { | ||
#[inline(always)] | ||
fn highest_prime() -> Self { | ||
65_521 | ||
} | ||
} | ||
|
||
impl HighestPrime for u8 { | ||
#[inline(always)] | ||
fn highest_prime() -> Self { | ||
251 | ||
} | ||
} |
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.