-
Notifications
You must be signed in to change notification settings - Fork 8
Removed non-empty restriction #26
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
base: develop
Are you sure you want to change the base?
Conversation
i guess it may be possible with this support both empty and non empty in same codebase based on proof #30 |
You are right. I thought this project is dead so i created similar lib that utilizes const checks. https://gitlab.com/fili_pk/bounded-vector |
Ok, now it should be non breaking. |
|
||
/// Returns the last and all the rest of the elements | ||
pub fn split_last(&self) -> (&T, &[T]) { | ||
const { assert!(L != 0) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crazy. need to change my pr to this if that works. like if assert does create new type constraint, also being just const assert.
i tried to do this (as in PR): struct X<const A: usize>;
impl<const A: usize> X<A> {
const QWE : () = {
assert!(A > 0);
assert!(A != 0);
};
pub fn new() -> Self {
const { assert!(A > 0) };
const { assert!(A != 0) };
Self
}
}
impl X<0> {
pub fn new() -> Self {
Self
}
} and got
My assumption that |
Const assert it not type constraint. But it gives compiletime error if lib user use it wrongly. For that you need const generic expressions i think. |
So added here empty vs not #31 |
@sethdusek i propose to close this in favor of #31 |
I removed non-empty restriction. It is breaking change!