-
Notifications
You must be signed in to change notification settings - Fork 58
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
Make new unchecked unsafe #72
Comments
I'm not 100% sure anymore, maybe @tguichaoua remembers why this was added in #35? |
Back when it was added it was impossible to do comparison in a const function, so to create a macro_rules! day {
($day:expr) => {
const {
let day: u8 = $day;
match Day::new(day) {
Some(day) => day,
None => panic!("invalid day number `{day}`, expecting a value between 1 and 25"),
}
}
};
} Also |
Interesting, thanks for the input. |
I was just reading your code and was wondering what's up with the
Day::__new_unchecked
function.Wouldn't it make more sense to "really" expose it publicly and make it unsafe, so that the caller has to take care to uphold safety?
The text was updated successfully, but these errors were encountered: