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.
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!