-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement generic
assert_impl
macro (#28)
* Generalize Deref trick using type-level booleans The Deref trick used in `assert_impl_any` can be generalized, and we get a general way of checking whether `$type: $trait` that can be used to implement most of the `assert_impl_*` and `assert_sub_*` macros. * Implement `assert_impl` macro, that subsumes a bunch of the other ones * Implement quantification for `assert_impl` This subsumes a few more impl macros * Use global booleans in `assert_impl` * No need for Deref trick when method priority does the job. As a nice side-effect, we don't need the local booleans to secure against blanket impls. * Make `to_bool!` usable in const contexts * Use associated constants instead of methods in assert_impl * Make boolean operators const fns * Extract `does_impl` macro that works in const contexts * Tweak Co-authored-by: Nikolai Vazquez <[email protected]>
- Loading branch information
Showing
5 changed files
with
238 additions
and
189 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
Oops, something went wrong.