Skip to content

Add ConstLowerBounded/ConstUpperBounded/ConstBounded traits, impls, and tests #351

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

linclelinkpart5
Copy link

Adds functionality as requested in #252.

This is done by adding ConstLowerBounded and ConstUpperBounded traits, with associated costs of const MIN: Self and const MAX: Self, respectively. In addition, I also included ConstBounded as a supertrait, and impl'd it for all types that implement ConstLowerBounded + ConstUpperBounded:

pub trait ConstBounded: ConstLowerBounded + ConstUpperBounded {}

impl<T: ConstLowerBounded + ConstUpperBounded> ConstBounded for T {}

These traits have been implemented for all primitive types that the existing Bounded traits have been impl'd for.

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.

1 participant